Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Getting all used parameters from a Template::Toolkit template

by assemble (Friar)
on Mar 11, 2009 at 13:29 UTC ( [id://749865]=note: print w/replies, xml ) Need Help??


in reply to Getting all used parameters from a Template::Toolkit template

Update: I just re-read the post and realized this isn't what you would want, nevermind

Another option is to shove all of your form values into a hashref and send that to TT, like this:

my $form_fields = { user_name => 'username', user_pass => 'userpass', other_field => 'value', };

Later on, pass this into TT as a var named 'form' or something like that. Your template code would be something like:

[% FOREACH field IN form %] [% field.key %]: [% field.value %] [% END %]

Replies are listed 'Best First'.
Re^2: Getting all used parameters from a Template::Toolkit template
by Corion (Patriarch) on Mar 11, 2009 at 13:32 UTC

    And how would this solution know that the template has used user_name already and not output it?

      I missed that part of the original post--it wouldn't help with what you want. Oops

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found