Hi,

I need some advice about an old 5.7 plugin that I came across at a client site. The plugin wraps CGI::Expand to deal with hierarchical parameters (see expand_cgi export in CGI::Expand docs).

They want to migrate the app to 5.8 and this plugin was doing some nasty stuff - monkeypatching Catalyst::Request like this:

    package Catalyst::Request;
    __PACKAGE__->mk_accessors('hparams');

This is of course a no-no with CatMoose.

Reading through the docs, I see that I can subclass the Catalyst::Request class and use the $c->request_class to setup the new one. I've done that like this:

package My::Request;

use Moose;

BEGIN { extends 'Catalyst::Request' }

has hparams => (
        isa => 'HashRef',
        is  => 'rw', 
        default =>  sub { {} },
);

no Moose;
__PACKAGE__->meta->make_immutable;

1;

I have two questions:

* is it possible for a plugin, at setup time, to set the request_class()?
 * is there a better way?

Best regards,

_______________________________________________
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