> I found this problem when trying to distinguish between the case where
> an object method returns undef (which is valid in my case) and the case
> where a method doesn't exist (in which case I'd like to throw an error)
>
> Maybe there's a better way to do this? I agree that it would be nice to
> be able to distinguish between found, not found, found but undef and error.
Objects returning undef is fine (2.19 TT):
perl -e 'package A; sub foo {}; $a = bless {}, A; use Template; Template->new-
>process(\qq{([% a.foo %])\n},{a=>$a})'
()
Objects returning a list of (undef, "true value") is not fine which is even
more obscure:
perl -e 'package A; sub foo {(undef,"ouch")}; $a = bless {}, A; use Template;
Template->new->process(\qq{([% TRY; a.foo ; CATCH; e; END %])\n},{a=>$a})'
(undef error - ouch at input text line 1.
)
I'd be interested to see what is getting returned. I'm wondering if in the
original post if foo is an object blessed into the Foo namespace - I'm
guessing it isn't.
Paul Seamons
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates