[Catalyst] Advice needed on porting 5.7 plugin (monkeypatches Cat::Request)

Florian Ragwitz rafl at debian.org
Fri Aug 21 11:10:57 GMT 2009


On Fri, Aug 21, 2009 at 11:37:00AM +0100, Pedro Melo wrote:
> 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:

It's probably better to create a role to apply to the request class and,
optionally, use CatalystX::RoleApplicator to apply it.

See Catalyst::TraitFor::Request::BrowserDetect for an example.

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

Yes. See Catalyst::Plugin::Browser for that.

> * is there a better way?

Other than not doing it and using CX::RoleApplicator instead? None that
i've found so far.


-- 
BOFH excuse #383:
Your processor has taken a ride to Heaven's Gate on the UFO behind
Hale-Bopp's comet.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090821/452e5d44/attachment.pgp


More information about the Catalyst mailing list