[Catalyst-dev] Proposed patch for ActionClass attribute

Tomas Doran bobtfish at bobtfish.net
Sat Apr 18 13:46:10 GMT 2009


On 3 Apr 2009, at 19:19, Bruce McKenzie wrote:
>
> I implemented application-specific an Application-specific action,  
> and found the "MyAction" construct to be a little odd. So I took a  
> run at extending the ActionClass parser to look for a local app  
> version ("MyApp::Action::Foo") first, then to fall back to the  
> Catalyst version ("Catalyst::Action::Foo") if that's not present.  
> You can still use "+My::Full::Path" to force a particular selection  
> (such as to skip over an app version for some reason).
>
> Is there a reason that this wasn't tried before?
>
> I hope this helps. I'd appreciate feedback, and can provide the  
> tests and doc if this is interesting enough to proceed. Catalyst is  
> a neat system, and I appreciate the hard work of those who have  
> made it what it is today.
>

Hi bruce. Sorry for dropping this for a couple of weeks.

First of all - this sounds like a great idea, but I don't like your  
implementation. As a note, unified diffs are preferred generally.

You should be looking to patch:

http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk/

However I have to say that the bit of code you're thinking about  
patching is something we're heavily prototyping at the moment... With  
Catalyst 5.80 (to be released real soon now), applying roles to  
action (and many other) classes is possible, and these also could  
have nice namespace stuff doing to them.

Have a look at the cute namespace code in an (abandoned, do not try  
to use) prototype:

http://github.com/rafl/catalyst-app-roleapplicator/blob/ 
64ffd5cc3ed3c3df990ad0e9b18aea413cccc617/lib/Catalyst/App/ 
RoleApplicator.pm

I like the prefix idea, and its not as ambiguous as 'load namespace  
one, or namespace two'.

I'd guess the namespace stuff should be done in a generic way in  
Catalyst::Utils, and then re-used for ActionClass/ActionRole and all  
the other things like request class / request class roles, etc, etc etc.

Well volunteered.

Cheers
t0m

P.S. There is an actual working prototype of App::RoleApplicator, but  
without any of the namespace stuff on CPAN.



More information about the Catalyst-dev mailing list