Skip Menu |
 

This queue is for tickets about the autodie CPAN distribution.

Report information
The Basics
Id: 55170
Status: resolved
Priority: 0/
Queue: autodie

People
Owner: Nobody in particular
Requestors: offer.kaye [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.23



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>
Download (untitled) / with headers
text/plain 826b
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
Download (untitled) / with headers
text/plain 1.4k
On Wed Mar 03 03:56:26 2010, offer.kaye@gmail.com wrote: Show quoted text
> 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,
Hi, Thanks for your bug report and sorry for the very late reply. At this time I cannot reproduce this bug in the current version of autodie, but I cannot even reproduce it in the version shipped with perl 5.10.1 (which is the one you seemed to be using). My best bet at this point is that we are looking at a bug in perl itself that caused it to ignore the use of "no warnings qw(uninitialized)". I am taking the liberty of marking this bug as resolved though I do not have a hint to what version of autodie or perl fixed it. ~Niels
Subject: Re: [rt.cpan.org #55170] Missing file argument for open causes "Use of uninitialized value" message
Date: Sun, 13 Oct 2013 19:55:52 +0200
To: bug-autodie [...] rt.cpan.org
From: Offer Kaye <offer.kaye [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
On Sun, Oct 13, 2013 at 12:13 PM, Niels Thykier via RT wrote: Show quoted text
> > At this time I cannot reproduce this bug in the current version of autodie, but I cannot even reproduce it in the version shipped with perl 5.10.1 (which is the one you seemed to be using). My best bet at this point is that we are looking at a bug in perl itself that caused it to ignore the use of "no warnings qw(uninitialized)". > > I am taking the liberty of marking this bug as resolved though I do not have a hint to what version of autodie or perl fixed it. > > ~Niels >
Hi Niels, Using autodie 2.22 and Perl 5.18.1 I am able to reproduce the exact same error: $ cat test.pl #!/usr/bin/env perl use autodie qw(:all); my $infile = $ARGV[0]; # didn't check $ARGV[0] was given, noob error... open(my $in_fh , '<' , $infile); $ perl -le'use autodie; print "$autodie::VERSION"' 2.22 $ perl -v This is perl 5, version 18, subversion 1 (v5.18.1) built for i686-linux $ ./test.pl Use of uninitialized value $file in sprintf at /.../perl-5.18.1/lib/site_perl/5.18.1/autodie/exception.pm line 407. Can't open '' for reading: 'No such file or directory' at ./test.pl line 4 Regards, Offer Kaye
Download (untitled) / with headers
text/plain 917b
On Sun Oct 13 13:56:09 2013, offer.kaye@gmail.com wrote: Show quoted text
> [...] > > Hi Niels, > Using autodie 2.22 and Perl 5.18.1 I am able to reproduce the exact > same error: > > $ cat test.pl > #!/usr/bin/env perl > use autodie qw(:all); > my $infile = $ARGV[0]; # didn't check $ARGV[0] was given, noob > error... > open(my $in_fh , '<' , $infile); > > $ perl -le'use autodie; print "$autodie::VERSION"' > 2.22 > > $ perl -v > This is perl 5, version 18, subversion 1 (v5.18.1) built for i686- > linux > > $ ./test.pl > Use of uninitialized value $file in sprintf at > /.../perl-5.18.1/lib/site_perl/5.18.1/autodie/exception.pm line 407. > Can't open '' for reading: 'No such file or directory' at ./test.pl > line 4 > > > > Regards, > Offer Kaye
Aha, indeed. It seems my failure to reproduce was caused by using a raw "undef" rather than "$ARGV[0]". But indeed, this affects the git master branch as well. ~Niels
Download (untitled) / with headers
text/plain 1.1k
On Wed Mar 03 03:56:26 2010, offer.kaye@gmail.com wrote: Show quoted text
> 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,
Hi, The undef warning have been fixed in 2.23 and the message is now: """ Can't open '<undef>' for reading: 'No such file or directory' at -e line 1 """ It should hopefully make it clear that the problem is due to faulty arguments.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.