Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

(elbie 3): Template Toolkit, and delaying the execution of a function

by elbie (Deacon)
on Aug 20, 2001 at 21:47 UTC ( #106281=note: print w/ replies, xml ) Need Help??


in reply to Re: (elbie): Template Toolkit, and delaying the execution of a function
in thread Template Toolkit, and delaying the execution of a function

I tried a couple of different things with Template::Stash to get the output of the subroutine, but all seem to result in STDOUT from the subroutine to print at the top of the page.

Here's my modified code:

my $tmpl_stash = Template::Stash->new( { 'show_subcat' => \&show_subcat( $lpmkey ), } ); my $tmpl_data = { "${lpmkey}select" => ' selected', # 'show_subcat' => show_subcat( $lpmkey ), 'lpmcat' => $lpmkey, 'lpmcategory' => { 'l' => 'Logos', 'p' => 'Photos', 'm' => 'More', }->{ $lpmkey }, };

And then I have a <code>{#PERL#} block like you suggested in your post. I also just tried running the subroutine from the block directly, avoiding using Template::Stash, but I'm still running into the same problem.

Any help would be appreciated.

elbieelbieelbie


Comment on (elbie 3): Template Toolkit, and delaying the execution of a function
Download Code
Re: (elbie 3): Template Toolkit, and delaying the execution of a function
by perrin (Chancellor) on Aug 21, 2001 at 03:42 UTC
    Drat! That should have worked.

    Well, actually, in the first case you don't need to put that specially in the Stash. You should be able to pass it in with the other data when you call process().

    It really should work when you call it directly from within a PERL block though. Are you doing anything with STDOUT in your sub?

    At this point, you might want to post to the TT mailing list and ask why the PERL block isn't working. I'm pretty sure it's supposed to work for exactly this case. You can find the mailing list at http://template-toolkit.org/.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://106281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-10-31 07:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (215 votes), past polls