* Barrie Slaymaker <[EMAIL PROTECTED]> [2002-12-20 08:52]:
> I've kludged code to peer in to TT2 templates to get at [%META%]
> declarations (it does not allow this by default AFAICS, surprisingly,
> I had to grovel through the template object's guts for meta info), and
> this has proven to be a useful way to let a template declare features
> or request certain preprocessing functions, like options parsing :).
Oh, that's a pretty straightforward (though completely undocumented) one:
use Template::Provider;
my $tp = Template::Provider->new(INCLUDE_PATH => [ 'here', 'there' ]);
my $d = $tp->fetch("filename");
$d is a Template::Document, which has a nifty AUTOLOAD -- you can call
methods based on the name of the META variable. So, with this template:
[% META foo = 'bar' %]
...
You can call:
my $foo = $d->foo();
and get 'bar'.
(darren)
--
Hard as it is to believe, sometimes bloody, proletariat revolution
just isn't the answer. Like in Algebra class, for example.
-- Don Swain