spsg has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Access Request Object from RAWPERL block in Template Toolkit template
by WizardOfUz (Friar) on Dec 15, 2009 at 16:02 UTC | |
|
Re: Access Request Object from RAWPERL block in Template Toolkit template
by Anonymous Monk on Dec 15, 2009 at 14:58 UTC |