[Catalyst] why is c.req.action missing leading slash?

Sebastian Riedel sri at oook.de
Sun Aug 14 01:09:21 CEST 2005


Am 13.08.2005 um 22:52 schrieb Phil Mitchell:

> On 8/13/05, Sebastian Riedel <sri at oook.de> wrote:
>
>>
>> Am 13.08.2005 um 20:03 schrieb Phil Mitchell:
>>
>>
>>> Bug or feature? Or am I just completely confused?
>>>
>>> For an action such as '/page/edit', c.req.action holds 'page/ 
>>> edit' --
>>> I'm guessing that was done for a good reason, but it complicates my
>>> usage. Right now I'm abstracting all action names out of my view
>>> templates, so I have to worry about whether they have leading  
>>> slash or
>>> not.
>>>
>>
>> Don't use action, it won't work for regex, use c.req.match instead.
>> It has no leading slash cause c.req.base is guaranteed to have a
>> slash as last char.
>>
>
> That makes sense, of course, but the failure of:
>
> $c->forward($c->req->action)
>
> is pretty surprising...

Not if you think about it, we have a two level action mapping, public  
and private, you only forward to private actions. (before someone  
asks, thats neccessary for regex and other advanced action types we  
may support in the future)


--
sebastian




More information about the Catalyst mailing list