Subject: | Missing file argument for open causes "Use of uninitialized value" message |
Date: | Wed, 3 Mar 2010 10:55:19 +0200 |
To: | bug-autodie [...] rt.cpan.org |
From: | Offer Kaye <offer.kaye [...] gmail.com> |
Hi,
When doing something (admittedly wrong) such as:
use autodie qw(:all);
my $infile = $ARGV[0]; # didn't check $ARGV[0] was given, noob error...
open(my $in_fh , '<' , $infile);
If I call the script without an input argument I get:
Use of uninitialized value $file in sprintf at /<full path edited
out...>/perl5.10.0/lib/5.10.0/autodie/exception.pm line 397.
Can't open '' for reading: 'No such file or directory' at
./test_script.pl line 24
The second line is okay and what I expected to get, although it
perhaps would be clearer to say something like "Input file argument to
open not defined at ./test_script.pl line 24", instead of "Can't open
'' for reading".
However the first line is I think wrong to output since it is an
internal error message from the autodie/exception.pm module.
Best regards,
--
Offer Kaye