Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 14877
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: juannavarroperez [...] gmail.com
Cc:
AdminCc:

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



Subject: strange warnings when reading a file and then start_html
I have found this really strange bug (?). It happens under a set of some very strange circumstances: you read a file (whose name came from @ARGV) and then use a start_html. As it is very weired I am not sure if its perl or CGI's fault, or even worst some "intended magic feature" that I am missing. See the code below for more details: #!/usr/bin/perl -w use strict; use CGI qw/:standard/; # if another array is used instead of @ARGV, it works. # e.g. @OTHER = @ARGV and loop foreach(@OTHER) foreach (@ARGV) { open (INPUT, "< $_") or die "Can't open: $_"; while (<INPUT>) { } # comment out this line and it works close INPUT; # this produces some warnings print start_html; } exit 0; Run this supplying any file name in the command line (it does not seem to matter which kind of file or its contents). Then it produces the following warnings: Use of uninitialized value in substitution (s///) at (eval 3) line 15. Use of uninitialized value in substitution (s///) at (eval 3) line 16. Use of uninitialized value in join or string at (eval 3) line 19. Use of uninitialized value in join or string at (eval 3) line 22. I am running in a perl, v5.8.5 built for cygwin-thread-multi-64int.
On Sun Oct 02 10:07:38 2005, guest wrote: Show quoted text
> I have found this really strange bug (?). It happens under a set of > some very strange circumstances: you read a file (whose name came > from @ARGV) and then use a start_html. As it is very weired I am > not sure if its perl or CGI's fault, or even worst some "intended > magic feature" that I am missing. See the code below for more > details: > > #!/usr/bin/perl -w > > use strict; > use CGI qw/:standard/; > > # if another array is used instead of @ARGV, it works. > # e.g. @OTHER = @ARGV and loop foreach(@OTHER) > foreach (@ARGV) { > open (INPUT, "< $_") or die "Can't open: $_"; > while (<INPUT>) { } # comment out this line and it works > close INPUT; > > # this produces some warnings > print start_html; > } > > exit 0; > > Run this supplying any file name in the command line (it does not seem > to matter which kind of file or its contents). Then it produces the > following warnings: > > Use of uninitialized value in substitution (s///) at (eval 3) line 15. > Use of uninitialized value in substitution (s///) at (eval 3) line 16. > Use of uninitialized value in join or string at (eval 3) line 19. > Use of uninitialized value in join or string at (eval 3) line 22. > > I am running in a perl, v5.8.5 built for cygwin-thread-multi-64int.
On Sun Oct 02 10:07:38 2005, guest wrote: Show quoted text
> I have found this really strange bug (?). It happens under a set of > some very strange circumstances: you read a file (whose name came > from @ARGV) and then use a start_html. As it is very weired I am > not sure if its perl or CGI's fault, or even worst some "intended > magic feature" that I am missing. See the code below for more > details: > > #!/usr/bin/perl -w > > use strict; > use CGI qw/:standard/; > > # if another array is used instead of @ARGV, it works. > # e.g. @OTHER = @ARGV and loop foreach(@OTHER) > foreach (@ARGV) { > open (INPUT, "< $_") or die "Can't open: $_"; > while (<INPUT>) { } # comment out this line and it works > close INPUT; > > # this produces some warnings > print start_html; > } > > exit 0; > > Run this supplying any file name in the command line (it does not seem > to matter which kind of file or its contents). Then it produces the > following warnings: > > Use of uninitialized value in substitution (s///) at (eval 3) line 15. > Use of uninitialized value in substitution (s///) at (eval 3) line 16. > Use of uninitialized value in join or string at (eval 3) line 19. > Use of uninitialized value in join or string at (eval 3) line 22. > > I am running in a perl, v5.8.5 built for cygwin-thread-multi-64int.
This was caused by the documented debugging behavior, which reads from STDIN and is enabled by default. You can disable it like this, and if you do so in your script, you'll see that the warnings stop: use CGI qw/:standard -no_debug/; Still, it would be nice to provide a better error message than this in cases where people accidently do this. I think a patch to address this should be considered if a formal test case and patch are submitted. Mark
No test or patch has been supplied for this "wishlist" item in over 3 years, and not even a "me too" comment has been added. I'm resolving this now to due old age. If someone still cares about this, please submit a Test::More-style test case or a patch.