Xavier Robin wrote:
Hello,

I'm new at Catalyst and I'm doing an application for storing biological metadata documents concerning an experiment.

I want (or I would like) to have the following structure of URLs:

(1) /experiment
(2) /experiment/<exp_number>
(3) /experiment/<exp_number>/gel
(4) /experiment/<exp_number>/gel/<gel_number>
(5) /experiment/<exp_number>/gel/<gel_number>/<a_lot_of_actions>

So I have the following actions :
(1) sub ask_experiment : PathPart('experiment') Chained('/') Args(0) { }
(2) sub show_experiment : PathPart('experiment') Chained('/') Args(1) { }
(3) sub experiment : PathPart('experiment') Chained('/') CaptureArgs(1) { }
And :
(3) sub ask_gel : PathPart('gel') Chained('experiment') Args(0) { }
(4) sub show_gel : PathPart('gel') Chained('experiment') Args(1) { }
(5) sub gel : PathPart('gel') Chained('experiment') CaptureArgs(1) { }

It works fine, exactly as I want it to be.
Now, because of <a_lot_of_actions>, I would like to put all the "gel*" actions in a specific package, and "experiment*" in another one.

package MyApp::Controller::Experiment;
sub ask_experiment : PathPart('experiment') Chained('/') Args(0) { }
sub show_experiment : PathPart('experiment') Chained('/') Args(1) { }
sub experiment : PathPart('experiment') Chained('/') CaptureArgs(1) { }
And
package MyApp::Controller::Gel;
sub ask_gel : PathPart('gel') Chained('experiment') Args(0) { }
sub show_gel : PathPart('gel') Chained('experiment') Args(1) { }
sub gel : PathPart('gel') Chained('experiment') CaptureArgs(1) { }

But then, it don't work anymore ! :-(
I tried to state the package explicitly in Chained(), for example :

sub ask_gel : PathPart('gel')
Chained('MyApp::Controller::Experiment::experiment') Args(0) { }
        Chained('/experiment/experiment')

You need the action private path, as shown in the startup debug log.

--
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to