I'm new to Perl and to Template Toolkit, so please excuse me, but I really need some help.
I'm sending the request object in the handler, like this:
my $r = shift;
my $request = Apache2::Request->new($r);
my %vars = (request => $request,...);
$TT->process($file_path, \%vars, $r) || return error($r,$TT->error( ))
And then, in the template, I do the following to access the request object:
[%RAWPERL%]my $request = $stash->get('request');[%END%]
I know it's working because I can get the parameters from the request object by doing this:
[%RAWPERL%]
my $request = $stash->get('request');
my $param1 = $request->param('param1');
$output .= $param1;
[%END%]
But I'm not sure if I'm doing this the right way, because I'm having some data inconsistency problems, and I'm trying to find out if the cause might be related to the way I'm accessing the request object.
I really would appreciate any help.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.