On Tue, 22 Jan 2008, Iglesias, Edward G. (Library) wrote:
> Okay, I should be able to solve this on my own but I can't. I've had
> to move to a new web server and can't get an old script to work. All it
> does is convert a fund activity report to a web page. It worked fine on
> the old server. I updated the directory paths and checked permissions.
> All are fine. What's more I don't get an error. It just works and
> returns nothing. Any help would be appreciated.
There's one more place where you might want to check for errors --
> close OUT; close HEAD;
Try the following change :
close OUT or die "Can't save OUT file: $!";
close HEAD or die "Can't save HEAD file: $!";
As strange as it sounds, there are instances where you can open a file for
writing, but can't actually write anything to it. (commonly, it occured
when the user had a quota which was exceeded by the write, or someone
unmounted the disk before you saved the file)
You recycle the filehandle 'OUT', and so it's closed again later, but you
should test there as well.
It's also a good idea to check the output of 'system' calls:
> system "cat head.txt body.txt > /data/www/htdocs/fundlist/$final";
> system "rm head.txt";
> system "rm body.txt";
(system "cat head.txt body.txt > /data/www/htdocs/fundlist/$final"
== 0) or warn "Can't concat files : $!";
unlink "head.txt" or warn "Can't remove head : $!";
unlink "body.txt" or warn "can't remove body : $!";
(system has an odd return -- it should return 0 on success)
oh ... and for those who don't do much perl programming -- '$!' is where
error messages get stored, so you can propogate them up. Eg:
purple:~ oneiros$ perl -e 'unlink "/tmp/adsadasd" or warn "cant unlink: $!"'
cant unlink: No such file or directory at -e line 1.
-----
Joe Hourcle
|