CC: | Caleb Cushing <xenoterracide [...] gmail.com> |
Subject: | [PATCH] handle eval-ed code |
Date: | Fri, 18 Jun 2010 22:33:37 -0400 |
To: | bug-Template-Timer [...] rt.cpan.org |
From: | Caleb Cushing <xenoterracide [...] gmail.com> |
Most refs are Template::Document, check that first and explicitly to make sure
we don't crash if a ref isn't a Template::Document or an ARRAY or SCALAR.
evals are scalar so fix that too. fixes bugs #13225, #13366, #15457.
Signed-off-by: Caleb Cushing <xenoterracide@gmail.com>
---
fix accidental tab
Timer.pm | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Timer.pm b/Timer.pm
index 74ccbc9..9b23917 100644
--- a/Timer.pm
+++ b/Timer.pm
@@ -71,12 +71,12 @@ foreach my $sub ( qw( process include ) ) {
my $self = shift;
my $what = shift;
- my $template =
- ref($what) eq 'ARRAY'
- ? join( ' + ', @{$what} )
- : ref($what)
- ? $what->name
- : $what;
+ my $template
+ = ref($what) eq 'Template::Document' ? $what->name
+ : ref($what) eq 'ARRAY' ? join( ' + ', @{$what} )
+ : ref($what) eq 'SCALAR' ? '(evaluated block)'
+ : $what
+ ;
my $level;
my $processed_data;
--
1.7.1