* Dave Hodgkinson <[EMAIL PROTECTED]> [2002-07-30 09:22]:
> params.my_thingy is only returning one value, probably as per the CGI
> docs which requires:
>
> @turned_on = $query->param('group_name');
>
> Since I'm going to be using a Plugin to handle this, can I reference
> the CGI object from my plugin? I tried finding it in the stash...
You can get at the CGI object by doing:
$context->stash->get('q', 0);
Random plugin:
package Template::Plugin::Random;
use base qw(Template::Plugin);
use Data::Dumper;
sub new {
my ($class, $context) = @_;
bless { _CONTEXT => $context } => $class;
}
sub stuff {
my $self = shift;
my $cgi = $self->{ _CONTEXT }->stash->get('q', 0);
return Data::Dumper->Dump([$cgi], ['cgi']);
}
1;
Command-line test:
$ tpage
[% USE q = CGI %]
[% USE Random %]
[% Random.stuff %]
Output:
$cgi = bless( {
'.charset' => 'ISO-8859-1',
'.parameters' => [
'keywords'
],
'.fieldnames' => {},
'keywords' => [
'GLOB(0x8104f6c)'
]
}, 'CGI' );
Yes?
(darren)
--
All truth passes through three stages: first, it is ridiculed;
next it is violently attacked; finally, it is held to be
self-evident.
-- Schopenhauer
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates