[Templates] Template::Stash::_dotop hates me
Randal L. Schwartz
merlyn@stonehenge.com
Sat, 03 Mar 2007 11:27:35 -0800
Well, not just me: it hates anything that has overloaded magic.
Here's my fix:
--- Stash.pm-DIST 2007-02-09 09:35:16.000000000 -0800
+++ Stash.pm 2007-03-03 11:19:57.000000000 -0800
@@ -383,7 +383,7 @@
sub _dotop {
my ($self, $root, $item, $args, $lvalue) = @_;
my $rootref = ref $root;
- my $atroot = ($root eq $self);
+ my $atroot = eval { $root->isa(ref $self) } && ($root eq $self);
my ($value, @result);
$args ||= [ ];
I *think* this does what's intended, as in only compare $root to $self if
$root could possibly be a Template::Stash object. All of the other solutions
I could come up with would *require* "use overload" to be brought in, which
makes things bad.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!