From: Matt S Trout Date: Sat, 14 Sep 2013 17:55:13 +0000 (+0000) Subject: dear TT, you are a pain in the buttocks X-Git-Tag: v1.000005~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f4204a3cb10eac31bb4387275f10753d25bf07e;p=scpubgit%2FHTML-String.git dear TT, you are a pain in the buttocks --- diff --git a/Changes b/Changes index cf3f6cd..a99a289 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + - Ensure TT doesn't try and call methods instead of VMethods + 1.000004 - 2013-09-12 - Fix concatenating undef to HTML::String values. diff --git a/lib/HTML/String/TT.pm b/lib/HTML/String/TT.pm index 9a6d1dd..0244de8 100644 --- a/lib/HTML/String/TT.pm +++ b/lib/HTML/String/TT.pm @@ -18,6 +18,16 @@ use Template; use Template::Parser; use Template::Stash; +BEGIN { + my $orig_blessed = Template::Stash->can('blessed'); + no warnings 'redefine'; + *Template::Stash::blessed = sub ($) { + my $val = $orig_blessed->($_[0]); + return undef if defined($val) and $val eq 'HTML::String::Value'; + return $val; + }; +} + sub new { shift; Template->new( diff --git a/lib/HTML/String/Value.pm b/lib/HTML/String/Value.pm index e1f6c95..d6bac14 100644 --- a/lib/HTML/String/Value.pm +++ b/lib/HTML/String/Value.pm @@ -119,7 +119,7 @@ sub can { return ( do { local $@; - eval { blessed($self) and $self->_hsv_unescaped_string->isa(@_) } + eval { blessed($self) and $self->_hsv_unescaped_string->can(@_) } } or $self->SUPER::can(@_) );