Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
perlfunc:warnby gods (Initiate) |
on Aug 24, 1999 at 22:43 UTC ( [id://336]=perlfunc: print w/replies, xml ) | Need Help?? |
warnSee the current Perl documentation for warn. Here is our local, out-dated (pre-5.6) version: warn - print debugging info
warn LIST
Produces a message on STDERR just like die(), but doesn't exit or throw an exception.
If
LIST is empty and
If
No message is printed if there is a
You will find this behavior is slightly different from that of
Using a
# wipe out *all* compile-time warnings BEGIN { $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN } } my $foo = 10; my $foo = 20; # no warning about duplicate my $foo, # but hey, you asked for it! # no compile-time or run-time warnings before here $DOWARN = 1;
# run-time warnings enabled after here warn "\$foo is alive and $foo!"; # does show up
See the perlvar manpage for details on setting |
|