+ - Localize $@ in isa and can in case of modules that mishandle eval {}
- Support for single quotes (' to ')
1.000000 - 2012-08-13
return 1 if grep $_, map $_->[0], @{$self->{parts}};
}
+# we need to local $@ here because some modules (cough, TT, cough)
+# will do a 'die $@ if $@' without realising that it wasn't their eval
+# that set it
+
sub isa {
my $self = shift;
return (
- eval { $self->_hsv_unescaped_string->isa(@_) }
+ do {
+ local $@;
+ eval { blessed($self) and $self->_hsv_unescaped_string->isa(@_) }
+ }
or $self->SUPER::isa(@_)
);
}
sub can {
my $self = shift;
return (
- eval { $self->_hsv_unescaped_string->can(@_) }
+ do {
+ local $@;
+ eval { blessed($self) and $self->_hsv_unescaped_string->isa(@_) }
+ }
or $self->SUPER::can(@_)
);
}
my $html = html('<tag>').$raw_characters.html('</tag>');
is($html, $expected_output);
+ok(HTML::String::Value->isa('HTML::String::Value'), 'isa on class ok');
+
+is($@, '', '$@ not set by check');
done_testing;
'<foo>"$bar"</foo>'."\n"
);
+is(
+ do_tt(
+ '[% FOREACH item IN items %][% item %][% END %]',
+ { items => [ '<script>alert("lalala")</script>', '-> & so "on" <-' ] }
+ ),
+ '<script>alert("lalala")</script>'
+ .'-> & so "on" <-'
+);
+
done_testing;