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
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
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
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')
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
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 =~
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
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
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):
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);
10 matches
Mail list logo