Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime-TimeZone CPAN distribution.

Report information
The Basics
Id: 47930
Status: rejected
Priority: 0/
Queue: DateTime-TimeZone

People
Owner: Nobody in particular
Requestors: TJC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.91
Fixed in: (no value)



Subject: TZ::Local crashes if called from inside Template toolkit XS stash
The attached file calls DateTime::TimeZone::Local->TimeZone() from inside a callback function in a template toolkit xs stash. This has the surprising result of neatly exiting Perl upon return from the callback function, rather than returning to the template processing. This was tested with Template Toolkit 2.20 and 2.21, and DateTime::TimeZone 0.91 on Perl 5.10.0 on Linux and MacOSX. It seems to work OK with Perl 5.8.8 and DT::TZ 0.70.
Subject: crash.pl
#!/usr/bin/perl use strict; use warnings; use DateTime::TimeZone::Local; use Template; use Template::Stash::XS; print "DateTime::TimeZone version: " . $DateTime::TimeZone::VERSION . "\n"; print "Template version: " . $Template::VERSION . "\n"; my $status = 'FAILED'; my $template = '[% crasher() %]'; my $output; # Note that only the XS stash fails.. my $tt2 = Template->new( STASH => Template::Stash::XS->new ); $tt2->process(\$template, { crasher => \&crasher }, \$output); print "Generated output: $output\n"; $status = 'SUCCESS'; sub crasher { DateTime::TimeZone::Local->TimeZone; warn "** In crasher(), about to return.."; return 'foo'; } sub END { print "Status: $status\n"; }
Subject: Re: [rt.cpan.org #47930] TZ::Local crashes if called from inside Template toolkit XS stash
Date: Wed, 15 Jul 2009 20:55:00 -0500 (CDT)
To: Toby C via RT <bug-DateTime-TimeZone [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 15 Jul 2009, Toby C via RT wrote: Show quoted text
> The attached file calls DateTime::TimeZone::Local->TimeZone() from > inside a callback function in a template toolkit xs stash. > > This has the surprising result of neatly exiting Perl upon return from > the callback function, rather than returning to the template processing. > > This was tested with Template Toolkit 2.20 and 2.21, and > DateTime::TimeZone 0.91 on Perl 5.10.0 on Linux and MacOSX. > > It seems to work OK with Perl 5.8.8 and DT::TZ 0.70.
Considering that this code works fine for lots of people outside of the TT XS stash, I'm thinking the bug is in TT. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
I have reduced the problem to one which does not include DateTime::TimeZone now. (See attached). I'll close this bug. I was confused and thought it was relevant because rolling back DT:TZ was fixing the problem.
#!/usr/bin/perl use strict; use warnings; use Template; use Template::Stash::XS; print "Template version: " . $Template::VERSION . "\n"; my $status = 'FAILED'; my $template = '[% crasher() %]'; my $output; # Note that only the XS stash fails.. my $tt2 = Template->new( STASH => Template::Stash::XS->new ); $tt2->process(\$template, { crasher => \&crasher }, \$output) or warn "Failed to process..\n"; print "Generated output: $output\n"; $status = 'SUCCESS'; sub crasher { __PACKAGE__->load_subclass; warn "** In crasher(), about to return.."; return 'foo'; } sub END { print "Status: $status\n"; } sub load_subclass { my $class = shift; eval "use Nonexistent::Class"; if ($@) { warn "Caught expected failure to use Nonexistent::Class"; } }