[Catalyst-dev] RT #36209: convert internal path seperators for clarity

John Napiorkowski jjn1056 at yahoo.com
Mon Jun 2 21:11:15 BST 2008




--- On Sun, 6/1/08, Matt S Trout <dbix-class at trout.me.uk> wrote:

> From: Matt S Trout <dbix-class at trout.me.uk>
> Subject: Re: [Catalyst-dev] RT #36209: convert internal path seperators for clarity
> To: "Development of the elegant MVC web framework" <catalyst-dev at lists.scsys.co.uk>
> Date: Sunday, June 1, 2008, 3:12 AM
> On Sat, May 31, 2008 at 08:58:38AM -0400, Hans Dieter
> Pearcey wrote:
> > On Thu, May 29, 2008 at 09:35:57AM -0700, J. Shirley
> wrote:
> > > > $c->forward('Foo::bar') for
> MyApp::Controller::Foo::bar?
> > > >
> > > 
> > > That seems by far to make the most sense, and
> really should clarify things.
> > 
> > It will un-clarify any controller that changes
> config->{namespace}.
> 
> Well ... not really. I think it would simply ignore
> config->{namespace}.
> 
> Perhaps better would be 'Foo->bar', then the
> code basically becomes
> 
> my $action = $c->controller(split('->',
> $str)[0])
>                ->action_for(split('->',
> $str)[1]);
> 
> I can see only two reasons for wanting to change the
> private path:
> 
> (1) in Root.pm to provide base /begin /auto and /end
> actions for the whole app
> (2) to split a large controller up into several but still
> $c->forward('foo')
> 
> Maybe we should look at finding a way to handle these cases
> that's saner.

I've always felt iffy about namespace being part of the controller class in this way.  The examples you gave (regarding /auto, etc and partitioning controllers) are the only ones I can think of as well.  However I have to wonder if this is too much tying of information to a controller?  I guess the fundamental question I have is if a controller should know it's namespace, or if that attribute should be assigned to it from from external class or process.  From my thinking a controller class should only know enough about itself to work, everything else should be passed into it from the dispatcher or from some sort of adapter class that 'wraps' it for consumption via the dispatching mechanism.  So I guess I am wondering if we are at the proper level of abstraction here?

_john napiorkowski

> 
> I'm pretty sure the private namespace is basically
> useless for anything else
> (yes, uri_for uses it, but any code that uses uri_for
> without either an action
> object or an absolute URL is basically broken and the new
> action_uri/whatever
> methods shouldn't need it at all).
> 
> > Are there any other cases where private path names
> don't match $package ::
> > $methodname?
> 
> Not that I can think of.
> 
> -- 
>       Matt S Trout       Need help with your Catalyst or
> DBIx::Class project?
>    Technical Director                   
> http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development or
> deployment platform?
> http://chainsawblues.vox.com/           
> http://www.shadowcat.co.uk/servers/
> 
> _______________________________________________
> Catalyst-dev mailing list
> Catalyst-dev at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


      



More information about the Catalyst-dev mailing list