[Catalyst] New class templates

Perrin Harkins perrin at elem.com
Fri Oct 21 16:21:33 CEST 2005


Svilen Ivanov wrote:
>>>>>>MyApp->config( name => 'MyApp' );
>>>>>
>>>>>Why not __PACKAGE__ instead of MyApp?
>>>>
>>>>Why?
>>>
>>>Because __PACKAGE__ always works, you don't have to s/MyApp/$MyApp/
>>>several times.
>>
>>The helper script already replaces "MyApp" with whatever the name of
>>your application is. :)
> 
> 
> IMHO the very first version of the application is usually called "MyApp" and 
> then later it is renamed to "TheProjectName" :)
> 
> I'd prefer the __PACKAGE__ but it isn't critical.

I always do that in my code, just because it makes it clear that I'm 
trying to refer to the current class, without the extra mental step of 
checking that MyApp is the name of that class.  It makes the intent more 
obvious.

- Perrin



More information about the Catalyst mailing list