[Catalyst] Re: about req.param
Fayland Lam
fayland at gmail.com
Fri Apr 11 09:57:51 BST 2008
Tatsuhiko Miyagawa wrote:
> Yes, because it's evaluated in a list context.
>
> I prefer doing $c->req->params->{a} for that reason.
params is full of traps too.
when it's from POST. we need use $c->req->params->{a}->[0];
I hate it.
>
> On 4/11/08, Fayland Lam <fayland at gmail.com> wrote:
>> code as follows:
>>
>> sub test : Local {
>> my ($self, $c) = @_;
>> my $test = {
>> a => $c->req->param('a'),
>> b => $c->req->param('b'),
>> c => $c->req->param('c'),
>> };
>> $c->res->body(Dumper(\$test));
>> }
>>
>> when visit as test?b=1
>> it shows
>>
>> $VAR1 = \{
>> '1' => 'c',
>> 'a' => 'b'
>> };
>>
>>
>> hmm, a trap I think. need use $c->req->param('a') || ''. something not so
>> good.
>>
>> --
>> Fayland Lam // http://www.fayland.org/ Foorum based on Catalyst //
>> http://www.foorumbbs.com/
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo:
>> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>
>
--
Fayland Lam // http://www.fayland.org/
Foorum based on Catalyst // http://www.foorumbbs.com/
More information about the Catalyst
mailing list