[Catalyst] Catalyst::Plugin::SubRequest default %params

Tomas Doran bobtfish at bobtfish.net
Wed Jan 20 20:00:20 GMT 2010


On 20 Jan 2010, at 01:55, Pavel O. Karoukin wrote:
> Is it only me who think that SubRequest should include current  
> request params by default and may be it was done this way by some  
> intent I am missing?

Yes it is just you :)

However nothing is stopping you writing:

around subrequest => sub {
     my ($orig, $self, @args) = @_;
     my $p = ref($args[-1]) eq 'HASH' ? pop(@args) : $c->req->params;
     $self->$orig(@args, $p);
};

Or something similar to add the params if you don't specify them  
manually..

You could even do something a little smarter with  
Catalyst::Utils::merge_hashes, I'll leave that as an exercise for the  
reader :)

Cheers
t0m




More information about the Catalyst mailing list