Skip Menu |

This queue is for tickets about the Catalyst-Plugin-HashedCookies CPAN distribution.

Report information
The Basics
Id: 42024
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-HashedCookies

People
Owner: OLIVER [...] cpan.org
Requestors: mst [...] shadowcat.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Module monkeypatches Catalyst::Request, should use ->request_class
Date: Mon, 29 Dec 2008 16:53:52 +0000
To: bugs-Catalyst-Plugin-HashedCookies [...] rt.cpan.org
From: Matt S Trout <mst [...] shadowcat.co.uk>
# apparently this should be done by subclassing Catalyst::Request and using # response_class, but I'm suspicious that that process isn't tolerant to # multiple users. *{Symbol::qualify_to_ref('validhashedcookies', 'Catalyst::Request')} = Class::Accessor::Fast::make_accessor('Catalyst::Request', 'validhashedcookies'); *{Symbol::qualify_to_ref('invalidhashedcookies', 'Catalyst::Request')} = Class::Accessor::Fast::make_accessor('Catalyst::Request', 'invalidhashedcookies'); Well, you can be as suspicious as you like, but ->request_class is supported and this horrific hack isn't. Your plugin will be broken on 5.80, and frankly if I could see an easy way to make it die on 5.70 I would - this is not rails, we do not monkeypatch things at random.. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
Subject: Re: [rt.cpan.org #42024] AutoReply: Module monkeypatches Catalyst::Request, should use ->request_class
Date: Mon, 29 Dec 2008 20:48:58 +0000
To: Bugs in Catalyst-Plugin-HashedCookies via RT <bug-Catalyst-Plugin-HashedCookies [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcat.co.uk>
On Mon, Dec 29, 2008 at 11:54:12AM -0500, Bugs in Catalyst-Plugin-HashedCookies via RT wrote: Show quoted text
> # apparently this should be done by subclassing Catalyst::Request and using > # response_class, but I'm suspicious that that process isn't tolerant to > # multiple users. > > *{Symbol::qualify_to_ref('validhashedcookies', 'Catalyst::Request')} = > Class::Accessor::Fast::make_accessor('Catalyst::Request', 'validhashedcookies'); > *{Symbol::qualify_to_ref('invalidhashedcookies', 'Catalyst::Request')} = > Class::Accessor::Fast::make_accessor('Catalyst::Request', 'invalidhashedcookies'); > > Well, you can be as suspicious as you like, but ->request_class is supported > and this horrific hack isn't. > > Your plugin will be broken on 5.80, and frankly if I could see an easy way > to make it die on 5.70 I would - this is not rails, we do not monkeypatch > things at random..
18:41 <@mst> it should be possible to set request_class during setup() time 18:41 <@mst> what you do is, -if- request_class is currently Catalyst::Request, set it to your subclass 18:42 <@oliver> oh okay 18:42 <@mst> if it isn't, then throw an exception saying "please make a MyApp::Request that isa Catalyst::Request::HashedCookies, WhateverElseTheyWereUsing and use that" 18:42 <@mst> -that- is how to play nice with multiple callers. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
Hi Matt, On Mon Dec 29 15:49:11 2008, mst@shadowcat.co.uk wrote: Show quoted text
> 18:41 <@mst> it should be possible to set request_class during setup()
This was (to my shame) really quite straightforward, so I have just uploaded a new release of the plugin to CPAN which uses request_class, and passes tests on Cat 5.7 and 5.8. Many thanks for your help :-) I have also put together a page in the Catalyst wiki which explains what I did (with suitable warning about how most plugins don't need to be a plugin): http://dev.catalyst.perl.org/wiki/gettingstarted/howtos/WritingPlugins regards, oliver.