I am using

__PACKAGE__->config->{ namespace } = 'foo';

sub obj_setup :  PathPart('') CaptureArgs(1) {}
sub create_setup : PathPart('') CaptureArgs(0) {}

sub view : PathPart('') Chained('obj_setup') Args(0) {}
sub edit : PathPart('') Chained('obj_setup') Args(0) {}
sub create : PathPart('create') Chained('create_setup') Args(0) { }

The thing I don't understand is that when the Chained actions are printed out, it gives me the correct actions as I would expect them. The create one just doesn't get matched.

Les

Christopher H. Laco wrote:
Christopher H. Laco wrote:
Les Fletcher wrote:
I have question about setting up PathPart's and Chaining.  I am trying
to set something that has the following look:

/namespace/ => This lists out a list of objects
/namespace/<id> => displays detail information about the object with the
numeric id=<id>
/namespace/<id>/edit => brings up a form to edit object with numeric
id=<id>
/namespace/create => brings up a form to create a new object

When the Chained actions are printed out everything looks fine, but when
I goto "/namespace/create" it matches the "/namespace/<id>" view
action.  Needless to say, there isn't an object with the numeric id of
"create."

I would like for Catalyst to try and match the explicit PathPart before
matching the wild card that is <id>.  Any thoughts on best ways to get
around this?
A couple of ways I thought of were:

I could make the view path be "/namespace/<id>/view," it seems a little
weird, but would be acceptable if need be.

I could have an action that matches "/namespace/*" and then forward to
the create action if "*" is "create" and to the view action other wise,
but this could limit my ability to further chain from here.

Catalyst just might not match the paths in a way that is conducive to
this, but just thought I'd throw this out there.

Les
http://use.perl.org/~LTjake/journal/31738

-=Chris

I use this exact setup, and I assume most do. How is your create
declared?  sub create : Local {} ?

------------------------------------------------------------------------

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to