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

Bill Moseley moseley at hank.org
Mon Nov 15 20:10:59 GMT 2010


On Mon, Nov 15, 2010 at 11:10 AM, Dorian Taylor (Lists) <
dorian.taylor.lists at gmail.com> wrote:

>
>
> package MyApp;
>
> sub _date :Regex('^(\d{4}-\d{2}-\d{2})(.*)$') {
>    my ($self, $c) =3D @_;
>    my ($date, $rest) =3D @{$c->req->captures};
>    $c->req->path($rest);
>    $c->dispatcher->prepare_action($c);
>    $c->go($c->action, $c->req->args);
> }
>
> This exhibits exactly the behaviour I was looking for.
>

Not sure I'd recommend this approach, but at one point I had code that
worked something like this: before prepare_action ran I'd look at the path
and if the first path segment matched a list of values I'd then strip that
segment off the path, set a flag in the stash, and then update $c->req->path
with the new path and continue the request.



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20101115/99079=
b78/attachment.htm


More information about the Catalyst mailing list