* On Fri, Apr 11 2008, Fayland Lam wrote:
> Fayland Lam 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));
>> }
>>
>
>
> well, this is OK
>
> sub test : Local {
>     my ($self, $c) = @_;
>
>     my $test = {
>         a => $c->req->params->{'a'},
>         b => $c->req->params->{'b'},
>         c => $c->req->params->{'c'},
>     };
>     $c->res->body(Dumper(\$test));
> }

Yes, param only exists so you can pass $c->req to a function expecting a
CGI object.  (It's for compatibility, not for use in new applications.)

If you really want to use a function call instead of a hash lookup,
apply this role to the request class:

  
http://git.jrock.us/?p=MooseX-Param-Safe.git;a=blob;f=lib/MooseX/Param/Safe.pm;hb=HEAD

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"

_______________________________________________
List: Catalyst@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/

Reply via email to