SPUG: warnings in Perl (was: CGI::Form errors?)

Adam Monsen adamm at wazamatta.com
Sat Jul 20 14:04:24 CDT 2002

On 20/07/02 10:10 -0700, Richard Anderson wrote:
> If you want to shut off the warnings try the use warnings pragma
> (newer versions of Perl) or set the $^W variable.

I'm sure this is what Richard meant, but to shut off warnings you need
to have a line like

  no warnings;

in your code (not "use warnings;"). Also, I would recommend against
playing with $^W unless you know what you're doing... it only modifies
the value of $^W at runtime, so it won't catch warnings that are usually
raised at compile time.

I think the general consensus I got from the Perlmonks
(http://www.perlmonks.com and #perl on openprojects.net -- thanks, wog)
is that it's better to do 'use warnings' or 'no warnings' to toggle
warnings when using a version of Perl that supports the warnings pragma.

Adam Monsen

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list