[Catalyst] Re: Request paths - rejoining Chained actions together.
Tomas Doran
bobtfish at bobtfish.net
Mon May 12 01:11:48 BST 2008
On 11 May 2008, at 15:17, Aristotle Pagaltzis wrote:
> * Tomas Doran <bobtfish at bobtfish.net> [2008-05-11 10:05]:
>> However, this does mean I now have 3 packages (a base class,
>> and two controllers), where before I had one file..
>
> There’s nothing stopping you from putting them all in a single
> file. :-)
Now, I may be going mad - but this doesn't play for me..
Make a test app, and add the following to the bottom of lib/MyApp/
Controller/Root.pm:
package MyApp::Controller::Foo;
use base qw(Catalyst::Controller);
sub one : Chained('/') PathPart('one') {}
sub two : Chained('one') PathPart('two') {}
sub end : Chained('two') PathPart('end') Args(0) {}
Start the test server.. You don't get any notification about
'MyApp::Controller::Foo' being loaded, and you don't see the chained
actions.
Comment out the 'package' line, and it works as expected. Split
things into files, and it works as expected.
Is this a known / documented bug / limitation?
>
>> (as, lets face it - splitting my code into 3 packages and
>> inheriting *in this case* is, a hack to get round Chained not
>> playing how I'd like it to)..
And so, as noted - I need to split to 3 files, which is less than
optimum.
> Au contraire. Inheritance is part of the language. Why should
> Catalyst invent a limited Catalyst-specific parallel mechanism?
I see what you're saying, but I'd consider re-use of controllers as
orthogonal to their dispatch patterns.
To be fair, if I can stuff the 3 relevant controllers into the same
file, then it's all good, and I'm a happy man - however as-is I can't..
Cheers
Tom
More information about the Catalyst
mailing list