[Templates] Template::Stash::_dotop hates me
Tatsuhiko Miyagawa
miyagawa@gmail.com
Sat, 3 Mar 2007 12:08:55 -0800
+1. Here is a similar patch sent 6 months ago.
http://www.mail-archive.com/templates@template-toolkit.org/msg08294.html
On 3/3/07, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>
> 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!
>
> _______________________________________________
> templates mailing list
> templates@template-toolkit.org
> http://lists.template-toolkit.org/mailman/listinfo/templates
>
--
Tatsuhiko Miyagawa