On Jan 18, 2008 10:51 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote:
snip
> > #!/usr/bin/perl
> >
> > use strict;
> > use warnings;
> >
> > $SIG{__DIE__} = sub {
> >    open my $fh, ">>", "something.log"
> >        or die @_, "could not open something.log: $!";
> >    print $fh @_;
> > };
> >
> > die "Oops";
snip
> OK, so were binding an anonymous subroutine to the DIE signal?
>
> Does this need to go above or below troublesome code in the script?
>
> Are the 'strict' and 'warnings' required for this code to work?  They are
> not in the script I'm working on and I'm worried about possible side-effects
> from adding those statements.
snip

The strict and warnings pragmas are not required for %SIG to do its
work, but your code should be using them.  You may have many subtle
bugs in your code if you don't.

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


Reply via email to