I have a configuration template "host.cfg" that has something like this
in it:

[%~

ip = '10.0.0.0'

~%]

When I process a template info.tt:

My IP is [% ip %]

I load the config using PRE_PROCESS:

my $tt = Template->new({'PRE_PROCESS' => 'host.cfg' });

$tt->process("info.tt");

Everything is fine. However, I wish to access the value of
"ip" outside a template. I thought I could access "ip" via the stash
like so:

my $tt = Template->new();
$tt->process('host.cfg');

print $tt->context()->stash()->get('ip'), "\n";

Alas, this doesn't work.

Is there a way to do this?

Thanks,

Mark

-- 
Mark Wagner <[EMAIL PROTECTED]>
System Administrator, UW Medicine IT Services
206-616-6119

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

Reply via email to