On Thu, Oct 22, 2009 at 11:10 AM, Bill Moseley <[email protected]> wrote:

> On Thu, Oct 22, 2009 at 10:20 AM, Sean McAfee <[email protected]> wrote:
>
>>
>>
>> You're *not* able to do that.  Template::Document localizes away whatever
>> warning hook the main application might have installed.
>>
>
>  TT $VERSION = '2.20';
>
>
> use strict;
> use warnings;
> use Template;
>
> my $tt = Template->new;
> my $template = '[% 1 + "" %]';
>
> $SIG{__WARN__} = sub { warn "[ALERT!!! @_]\n" };
>
> $tt->process( \$template );
>
> :!perl /home/moseley/warn.pl
> [ALERT!!! Argument "" isn't numeric in addition (+) at input text line 1.
> ]
> 1
>


Well, I can't explain that.  Check out the current trunk version of
Template::Document:

http://template-toolkit.org/svnweb/Template2/view/trunk/lib/Template/Document.pm

Right before template-derived code is evalled, there's this:

local $SIG{__WARN__} = \&catch_warnings;

catch_warnings is a sub that discards all warnings (by storing them in a
global variable that's never read from).


--Sean
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to