On 7/26/07, Matisse Enzer <[EMAIL PROTECTED]> wrote:

On Jul 25, 2007, at 8:36 PM, Bill Moseley wrote:

> On Wed, Jul 25, 2007 at 01:30:46PM -0700, Matisse Enzer wrote:
With DEBUG_UNDEF this template produces an error if    someMethod()
exists but
returns and empty list:

     [% FOREACH thing IN object.someMethod %]
         [% thing %]
     [% END %]

What I want is an error only if $object is undef, or if there is no
someMethod()   defined, and I want this behavior globally.

How about this:

[% IF object.can('someMethod') %]
    [% FOREACH thing IN object.someMethod %]
        [% thing %]
    [% END %]
[% END %]

Cheers,

Cees

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to