[Catalyst] namespace problem
Peter Karman
peter at peknet.com
Sat Nov 21 18:55:32 GMT 2009
gutta wrote on 11/21/09 7:46 AM:
>
> So you want me to write a MyApp/lib/Controller/Base.pm as follows.
>
> package MyApp::Controller::Base;
>
> use strict;
> use warnings;
>
> use parent 'Catalyst::Controller';
>
> #
> # Sets the actions in this controller to be registered with no prefix
> # so they function identically to actions created in MyApp.pm
> #
>
> =head1 NAME
>
> MyApp::Controller::Base - Base Controller for MyApp
>
> =head1 DESCRIPTION
>
> [enter your description here]
>
> =cut
>
> 1;
>
> and will do "use parent 'MyApp::Controller::Base';" instead of my previous
> statement "use parent 'MyApp::Controller::Root';"
>
I think you want to keep stuff out of MyApp::Controller::* namespace unless you
want it instantiated at app startup.
Instead, create MyApp::Base::Controller and inherit from that in your
MyApp::Controller::* classes.
Otherwise, yes, you've got the idea.
--
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the Catalyst
mailing list