Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 39453
Status: rejected
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: travis [...] verymetalnoise.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.34
  • 0.35
  • 0.41
Fixed in: (no value)



Subject: redefining __DIE__ causes an error when calculating the offset
I use DateTime in a daemon, and for some reason when I redefine $SIG{__DIE__} for debugging, it finds a fatal error: ----------------- #!/usr/bin/perl use DateTime; $SIG{__DIE__} = sub { print "DIE! " . join(" ", @_); exit; }; my $sldt = DateTime->new( year => 2008, month => 10, day => 25, hour => 7, minute => 15, second => 47, time_zone => 'America/Chicago', ); print $sldt->strftime('%z'), "\n"; ------------ produces: DIE! Can't call method "isa" without a package or object reference at /usr/local/share/perl/5.8.8/DateTime/TimeZone.pm line 492. whereas removing it is fine: ------------ #!/usr/bin/perl use DateTime; my $sldt = DateTime->new( year => 2008, month => 10, day => 25, hour => 7, minute => 15, second => 47, time_zone => 'America/Chicago', ); print $sldt->strftime('%z'), "\n"; ------------ produces: -0500 This occurs on both debian linux and win32, using perl 5.8.8. Apologies if it's been fixed in a more recent version, 0.41 is the latest I could easily install.
Subject: Re: [rt.cpan.org #39453] redefining __DIE__ causes an error when calculating the offset
Date: Sat, 20 Sep 2008 10:10:42 -0500 (CDT)
To: Travis Basevi via RT <bug-DateTime [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Sat, 20 Sep 2008, Travis Basevi via RT wrote: Show quoted text
> I use DateTime in a daemon, and for some reason when I redefine > $SIG{__DIE__} for debugging, it finds a fatal error: > > ----------------- > #!/usr/bin/perl > > use DateTime; > > $SIG{__DIE__} = sub > { > print "DIE! " . join(" ", @_); > exit; > }; > > my $sldt = DateTime->new( year => 2008, > month => 10, > day => 25, > hour => 7, > minute => 15, > second => 47, > time_zone => 'America/Chicago', > ); > print $sldt->strftime('%z'), "\n"; > > ------------ > produces: DIE! Can't call method "isa" without a package or object > reference at /usr/local/share/perl/5.8.8/DateTime/TimeZone.pm line 492.
You should not be calling exit from a signal handler like that! Keep in mind that lots of code uses eval { } to wrap code which might die and throw an exception. Normally we'd keep going just fine, but your really really broken $SIG{__DIE__} makes that impossible. This is definitely not a bug with DateTime. You need to rethink that handler a bit. Read about $^S in "perldoc perlvar", which might help a bit, although really, $SIG{__DIE__} is just broken no matter what, sadly. -dave /*========================== VegGuide.Org Your guide to all that's veg ==========================*/
From: travis [...] verymetalnoise.com
Thanks for the info, much appreciated, it all makes sense now. And at least I wasn't using the broken handler in production code! Sorry for wasting your time.