Re: [Catalyst] Moose's make_immutable in Catalyst classes

2012-10-24 Thread Tomas Doran

On 24 Oct 2012, at 05:35, Toby Corkindale wrote:
 I was just wondering.. should we be adding Moose's make_immutable call
 to the end of these classes?
 ie. __PACKAGE__-meta-make_immutable;


This makes things faster if you construct lots of them (and also makes things a 
bit safer, as they can't be changed), at the cost of a bit of startup time.

Generally Catalyst components are only initialised once (i.e. they're scoped to 
the lifetime of the app), so there is no speed benefit to immutable in this 
case (actually, it's probably a startup speed reduction), but I still tend to 
use it for the safety…

So it's entirely optional, in classes which implement ACCEPT_CONTEXT (and so 
are constructed once per request), you will see a speed benefit from doing it, 
but this is the less unusual case.. 

Cheers
t0m


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Moose's make_immutable in Catalyst classes

2012-10-23 Thread Toby Corkindale
Hi,
In modern Catalyst apps, we tend to create packages like this with Moose:

package MyApp::Controller::Foo;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
...
1;

I was just wondering.. should we be adding Moose's make_immutable call
to the end of these classes?
ie. __PACKAGE__-meta-make_immutable;

Cheers,
Toby

-- 
Turning and turning in the widening gyre
The falcon cannot hear the falconer
Things fall apart; the center cannot hold
Mere anarchy is loosed upon the world

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/