---------- Forwarded message ---------- From: Jonathan Mast <[EMAIL PROTECTED]> Date: Jan 18, 2008 10:50 AM Subject: Re: help me die verbosely To: "Chas. Owens" <[EMAIL PROTECTED]>
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. Thanks On Jan 17, 2008 10:50 AM, Chas. Owens <[EMAIL PROTECTED]> wrote: > On Jan 17, 2008 9:54 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > > I want to write the errors caught by a 'die' clause into a file. > snip > > Try > > #!/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"; >