On Fri, Mar 14, 2008 at 11:19 AM, Kashif Salman <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 14, 2008 at 11:10 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> 
> wrote:
>  > Kashif Salman wrote:
>  >  > I got this example code from the book "CGI Programming with Perl"
>  >  >
>  >  > #!/usr/bin/perl -wT
>  >  >
>  >  > use strict;
>  >  > use CGI;
>  >  >
>  >  > my $q = new CGI;
>  >  > print $q->header( "text/plain" );
>  >  >
>  >  > print "These are the HTTP environment variables I received:\n\n";
>  >  >
>  >  > foreach ( $q->http ) {
>  >  >     print "$_:\n";
>  >  >     print "  ", $q->http( $_ ), "\n";
>  >  > }
>  >  >
>  >  >
>  >  > Running this CGI script I get the expected output but I also get this
>  >  > error in my Apache error.log file;
>  >  > Use of uninitialized value in pattern match (m//) at (eval 11) line 3.
>  >  > Use of uninitialized value in transliteration (tr///) at (eval 11) line 
> 4.
>  >
>  >  The -w switch enables warnings dynamically, and apparently CGI.pm isn't
>  >  'warnings safe'. To get rid of those warnings, you can replace the -w
>  >  switch with the warnings pragma, which is lexically scoped.
>  >
>  >      use warnings;
>  >
>  >  OTOH, is there really any good reason to bother with a CGI.pm method for
>  >  this task?
>  >
>  >      print "$_\n  $ENV{$_}\n" for grep /^HTTP_/, keys %ENV;
>  >
>  >  --
>
>
>  I don't need CGI.pm for this task, I am just going through the book
>

If I am understanding this correctly does that mean -w would enable
warnings in my script as well as CGI.pm while 'use warnings' will
enable warnings only in my script?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to