Well if worse comes to worse you can always do something like this:
use Template;
my $old_warn = $SIG{'__WARN__'};
local $SIG{'__WARN__'} = sub{
if ($_[0] =~ m:Argument "" isn't numeric in addition:){
return;
}
if($old_warn){
return $old_warn->(@_);
}
};
Template->new->process(\q[[% 1 + "" %]]);
Personally, I almost think the template should blow up since that is kind of
undefined behavior and the developer should be forced to make sure their data
is correct and in a numeric format for this sort of thing.
-- Josh
Travis Basevi wrote:
> Sorry to bring this up from a year ago, but this problem is still
> annoying me with miles of entries in my apache error logs, and I was
> wondering if anyone had any simple solution to avoid it?
>
> I've tried "no warnings" in my modules, and playing with the apache
> LogLevel, but to no avail. I'm presently using Template v2.20 with
> Apache 2.2.14 mod_perl 2.0.4 and Perl 5.10.1
>
> :Travis
>
> Travis Basevi wrote:
>> Er, yeah, I'm fully aware of that. That example isn't real-world usage,
>> it's just an illustration of the problem at the simplest level.
>>
>> The point is that a TT2 coder shouldn't have to write at the level of a
>> hardcore Perl "use strict use warnings" coder to avoid these warnings.
>> And that's ignoring the point that the functionality of TT2 has changed
>> somewhere between 2.14 and 2.19 because of (I suspect) the introduction
>> of "use warnings" in the various modules.
>>
>> Bill Ward wrote:
>>> Well, it's not numeric, is it?
>>>
>>> On Wed, Oct 22, 2008 at 6:13 AM, Travis Basevi <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>
>>> I've just upgraded from TT 2.14 to 2.19 as part of a debian upgrade from
>>> etch to lenny, and I can't stop warnings appearing in the apache logs
>>> with something as simple as:
>>>
>>> [% 1 + "" %]
>>>
>>> giving: Argument "" isn't numeric in addition (+) at ...
>>>
>>> This never happened in v2.14, is it to be expected now? Or is there now
>>> an option for turning off these warnings?
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates