Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-23 Thread Alexander Hartmaier
Have you thought about making the date a parameter instead of part of the uri? -- Best regards, Alex On Mon, 2010-11-15 at 20:10 +0100, Dorian Taylor (Lists) wrote: Hi Larry, On 15-Nov-10, at 10:55 AM, Larry Leszczynski wrote: Hi Dorian - OK, but the part that confuses me is why /foo

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-16 Thread Ben van Staveren
Request-URI: /2010-11-15/foo * MyApp::_date is triggered * Removes the date from the first path segment and stashes it * Forwards to MyApp::Foo::index as if it was a fresh request and the date path segment was never there (except it is, in the stash). I just realised I made a little mistake

[Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Lists
Hi all, Suppose I want to have the first path match a pattern, like an ISO-8601 date. I then want to chop it out of the URI path and stash it and forward the request on to another handler in the fashion of mod_perl's $r-internal_redirect. Consider: package MyApp; sub _date

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Ben van Staveren
You want chained actions. package MyApp; sub _date :Chained('/') CaptureArgs(1) PathPart('date') { my $self = shift; my $c = shift; my $date = shift; $c-detach('invalid_date') unless($date =~ /^\d{4}-\d{2}-\d{2}/); $c-stash-{date} = $date; } sub something_using_the_date :Chained('/date')

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Eden Cardim
Dorian == Dorian Taylor (Lists) dorian.taylor.li...@gmail.com writes: Dorian I'm ambiguous on two things: Dorian 1) I don't understand why an outside request to /foo will find its way to Dorian /foo/index in MyApp::Foo but a forwarded request will not. I understand I'm Dorian

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Dorian Taylor (Lists)
Hi Ben, thanks for replying! On 15-Nov-10, at 4:00 AM, Ben van Staveren wrote: You want chained actions. package MyApp; sub _date :Chained('/') CaptureArgs(1) PathPart('date') { my $self = shift; my $c = shift; my $date = shift; $c-detach('invalid_date') unless($date =~

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Dorian Taylor (Lists)
Thanks Eden, On 15-Nov-10, at 8:58 AM, Eden Cardim wrote: Internal action paths are one thing and URI's are another. Forwarding and dispatching are two separate things. The dispatch process matches a URI and happens once per request (unless you invoke -go or -visit). Forwarding is mostly a

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Larry Leszczynski
Hi Dorian - OK, but the part that confuses me is why /foo doesn't resolve to MyApp::Foo::index with -go or -visit. Maybe this will help (I think in this case index works like default): http://wiki.catalystframework.org/wiki/wikicookbook/safedispatchusingpath HTH, Larry

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Dorian Taylor (Lists)
Hi Larry, On 15-Nov-10, at 10:55 AM, Larry Leszczynski wrote: Hi Dorian - OK, but the part that confuses me is why /foo doesn't resolve to MyApp::Foo::index with -go or -visit. Maybe this will help (I think in this case index works like default):

Re: [Catalyst] Forward on to other actions after removing first path segment?

2010-11-15 Thread Bill Moseley
On Mon, Nov 15, 2010 at 11:10 AM, Dorian Taylor (Lists) dorian.taylor.li...@gmail.com wrote: package MyApp; sub _date :Regex('^(\d{4}-\d{2}-\d{2})(.*)$') { my ($self, $c) = @_; my ($date, $rest) = @{$c-req-captures}; $c-req-path($rest); $c-dispatcher-prepare_action($c);