[sf-perl] Can't use an undefined value as filehandle reference
Vicki Brown
vlb at cfcl.com
Wed Jul 6 13:09:46 PDT 2005
I am trying to run tmail.pl
http://pugetsoundsoftware.com/tmail.html
for The Job. The Company still runs Perl 5.005_03. (Don't get me started).
I get an error running the script:
Can't use an undefined value as filehandle reference at tmail.pl line 149.
No error with newer Perl (5.8.5 on my desktop).
Here's the relevant code. The error is on line 5 in the example.
#!/usr/bin/perl
$szForm = "/www/private/nonexistent.txt";
DisplayError ("tmail: template form [$szForm] could not be opened")
if (!open ($file, "<$szForm")); # This line faults
sub DisplayError {
print @_, "\n";
}
Perl 5.8.5 runs successfully and prints
tmail: template form [/www/private/nonexistent.txt] could not be opened
Perl 5.00503 shows
Can't use an undefined value as filehandle reference at foo.pl line 5
How can I work around the problem?
Please don't suggest that I try to convince IT to upgrade Perl. :-(
That's not going to happen.
My other choice is to use a phenomenally ugly hunk of PHP code.
So if you can save me from that... Heeeeeeeeelllllllpppp!
--
- Vicki
ZZZ
zzZ San Francisco Bay Area, CA
z |\ _,,,---,,_ Books, Cats, Tech
zz /,`.-'`' -. ;-;;,_ http://cfcl.com/vlb
|,4- ) )-,_. ,\ ( `'-' http://cfcl.com/vlb/weblog
'---''(_/--' `-'\_) http://heatercats.com
More information about the SanFrancisco-pm
mailing list