When calling [% PROCESS block_1 + block_2 %] the block names are passed as an
array reference to process(). Template::Timer was assuming that any
ref() passed was an object and calling ->name on that object.
> @@ -63,7 +63,9 @@
> my $super = __PACKAGE__->can("SUPER::$sub") or die;
> *$sub = sub {
> my $self = shift;
> - my $template = ref $_[0] ? $_[0]->name : $_[0];
> + my $template = ref $_[0] eq 'ARRAY'
> + ? join( ' + ', @{$_[0]} )
> + : ref $_[0] ? $_[0]->name : $_[0];
> my $start = [Time::HiRes::gettimeofday];
> my $data = $super->($self, @_);
> my $elapsed = Time::HiRes::tv_interval($start);
This is not enough. Template::Timer has also problems with EVAL. I had
to patch:
--- Timer.pm~ 2005-08-16 15:02:26.000000000 +0200
+++ Timer.pm 2005-08-16 15:17:36.000000000 +0200
@@ -63,7 +63,7 @@
my $super = __PACKAGE__->can("SUPER::$sub") or die;
*$sub = sub {
my $self = shift;
- my $template = ref $_[0] ? $_[0]->name : $_[0];
+ my $template = (ref $_[0] and ref $_[0] ne 'SCALAR') ?
$_[0]->name : $_[0];
my $start = [Time::HiRes::gettimeofday];
my $data = $super->($self, @_);
my $elapsed = Time::HiRes::tv_interval($start);
So mabye it should check if it's no SCALAR ref and no ARRAY ref... Or it
checks can($_[0]->name) - but I don't know if this breaks when $_[0] is
no object.
Bye, Uwe
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates