On Tue, 10 Nov 2009, Dan Horne wrote:

The "die { found => 1 };" instruction sets $@ tp "HASH(0xac2a148) at /usr/local/lib/perl5/site_perl/5.10.0/DateTime/TimeZone/Local/Unix.pm line 115" and hence there is never a $...@->{found}.

What version of DT::TZ? As of 0.92, all uses of $@ should be cleanly local-ized before they are used, so they shouldn't be leaking.

Why it works for some calls and not this particular instance, I'll never know. After bashing my head trying to solve the problem for a couple of days, I have a simple workaround which is undoubtedly more efficient anyway, but which doesn't solve the underlying problem:

  our $TZ = DateTime::TimeZone->new( name => 'local' );
  sub now {
      my $self = shift;
      return DateTime->now(time_zone => $TZ);
  }

This is a really good idea _anyway_. Calculating the local time zone is slow, and it's really unlikely to change over the lifetime of your app. Calculate it once and cache it.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to