[Catalyst] Handling a path of '/'

Sebastian Riedel sri at oook.de
Fri Dec 2 04:37:50 CET 2005


Am 02.12.2005 um 04:26 schrieb Bill Moseley:

> On Thu, Dec 01, 2005 at 09:16:13PM -0600, Justin Guenther wrote:
>>> -----Original Message-----
>>> From: catalyst-bounces at lists.rawmode.org
>>> [mailto:catalyst-bounces at lists.rawmode.org] On Behalf Of Bill  
>>> Moseley
>>> Sent: December 1, 2005 9:07 PM
>>> To: The elegant MVC web framework
>>> Subject: Re: [Catalyst] Handling a path of '/'
>>>
>>> I just use default() in my App class for handling "/".  Any
>>> reason why using using Index or Path would be better?
>>
>> I opted not to use default() for this since I wanted to be able to  
>> serve out
>> 404 error pages for invalid paths.
>
> Why couldn't you do that?

Yes, he could have used default(), but not index() to handle the root  
itself!

     sub index   : Private { $_[1]->stash->{template} =  
'welcome.tt' }   # Handles only / (no args)

     sub default : Private { $_[1]->stash->{template} =  
'404.tt' }       # Handles all 404s


Path('/') is more a dwim thing, no unique feature.


--
sebastian




More information about the Catalyst mailing list