[Catalyst] How do I have Catalyst access a Controller based on only part of the PATH_INFO

2007-05-11 Thread Steve H

Hi

I'm used to (albeit a recent Catalyst convert) creating a Controller based 
on the whole name of the PATH_INFO, e.g.

 http://localhost:3000/some/structure/like/this
being:
 package my_app::Controller::some::structure::like::this
In a file my_app/lib/my_app/Controller/some/structure/like/this.pm
How would I have a Controller like:
 package my_app::Controller::some::structure
In a file my_app/lib/my_app/Controller/some/structure.pm
and be able to access the remaining like/this via PATH_INFO.

In case you are wondering why... I was wanting to have a catalogue menu hit 
back into the app at a common point, and use the remaining PATH_INFO to 
indicate the specifics of selection made.


This seems like it'd be pretty ordinary to be able to do... just that I 
can't see how to from the Catalyst documentation.  It's probably a case of 
me not being able to see the wood for the trees ... or it being something 
obvious yet documented in an implicit way dunno

going nuts
Steve

_
Advertisement: Its simple! Sell your car for just $30 at carsales.com.au 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801577%2Fpi%5F1005244%2Fai%5F838588_t=762955845_r=tig_may07_m=EXT



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] How do I have Catalyst access a Controller based on only part of the PATH_INFO

2007-05-11 Thread Matt S Trout
On Sat, May 12, 2007 at 12:20:53AM +1000, Steve H wrote:
 Hi
 
 I'm used to (albeit a recent Catalyst convert) creating a Controller based 
 on the whole name of the PATH_INFO, e.g.
  http://localhost:3000/some/structure/like/this
 being:
  package my_app::Controller::some::structure::like::this
 In a file my_app/lib/my_app/Controller/some/structure/like/this.pm
 How would I have a Controller like:
  package my_app::Controller::some::structure
 In a file my_app/lib/my_app/Controller/some/structure.pm
 and be able to access the remaining like/this via PATH_INFO.

That's actually how actions work by default - an action with a public
URL of /foo/bar will also match /foo/bar/baz/quux/tickle/me/elmo/whatever
unless you explicitly set the number of extra arguments via :Args(0)
(for /foo/bar only), :Args(1) for (/foo/bar/*), ...

This is why you often see code written as

sub bar :Local {
  my ($self, $c, @args) = @_;
  ...
}

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/