Dave Howorth wrote:
> my $tt = Template->new();

Try this:
  my $tt = Template->new( DEBUG => 'undef' );   # yes, the string "u n d e f"

> test.tt
> -------
> [% USE Test = Class('MyTest') ;
>    Test.method() ;
>    'success'
> %]

With the DEBUG flag set as shown, undefined values are thrown as exceptions:

  "undef error - method is undefined"

TT treats all data types as equal (more or less).  foo.bar returns 
the 'bar' part of 'foo', or undef if it doesn't exist (including a 
'bar' method missing from a 'foo' object).  And by default, TT ignores 
any undefined values unless you set the DEBUG => undef flag.

I admit it's not entirely obvious or helpful in cases like this, but that's 
the way it is I'm afraid.  It may get better in v3...

A


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

Reply via email to