[Catalyst] sample code for feedback

Rob Kinyon rob.kinyon at gmail.com
Fri Jun 24 04:46:30 CEST 2005


> And don't forget how easy it is to write a plugin... ;P
> 
> sub my_forward {
>      my ( $c, $forward, @args ) = @;
>      $c->req->args(@args);
>      $c->forward($forward);
> }

If it's something that everyone stumbles over, why isn't there an
option to do it? What's wrong with forward_with_args() that takes a
hash(ref) consisting of:
    class => $classname (defaults to __PACKAGE__)
    method => $methodname (defaults to 'process')
    args => \@args (defaults to [])

Or, add an optional arrayref at the end that would be the args? Then,
in the real forward(), you do something like:
    if (ref($_[-1]) eq 'ARRAY') {
        $c->req->args( @{ pop(@_) } );
    }

Rob



More information about the Catalyst mailing list