From: Tomas Doran (t0m) Date: Thu, 11 Jun 2009 09:29:30 +0000 (+0100) Subject: Merge X-Git-Tag: 0.07~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Component-ACCEPT_CONTEXT.git;a=commitdiff_plain;h=19ac5de9c674ceb9e73803f590fd5791a4f9c507;hp=a4e747a2dff3021072809234c43eed4f0f3cf4b1 Merge --- diff --git a/Changes b/Changes index 8b0aef0..0ec6338 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for Catalyst-Component-ACCEPT_CONTEXT +0.06 24 April 2009 Switch from NEXT to MRO::Compat 0.05 18 Jan 2008 diff --git a/lib/Catalyst/Component/ACCEPT_CONTEXT.pm b/lib/Catalyst/Component/ACCEPT_CONTEXT.pm index 34d0060..e77e4d7 100644 --- a/lib/Catalyst/Component/ACCEPT_CONTEXT.pm +++ b/lib/Catalyst/Component/ACCEPT_CONTEXT.pm @@ -12,11 +12,11 @@ request context available in Models and Views. =head1 VERSION -Version 0.05 +Version 0.06 =cut -our $VERSION = '0.05'; +our $VERSION = '0.06'; =head1 SYNOPSIS @@ -42,7 +42,7 @@ your model: Using this module is somewhat of a hack. Changing the state of your objects on every request is a pretty braindead way of doing OO. If you want your application to be brain-live, then you should use -L. +L. Instead of doing this on every request (which is basically what this module does): @@ -50,24 +50,24 @@ what this module does): $my_component->context($c); It's better to do something like this: - + package FooApp::Controller::Root; use base 'Catalyst::Controller'; use Moose; - + with 'Catalyst::Component::InstancePerContext'; has 'context' => (is => 'ro'); - + sub build_per_context_instance { my ($self, $c, @args) = @_; return $self->new({ context => $c, %$self, @args }); } - + sub actions :Whatever { my $self = shift; my $c = $self->context; # this works now } - + 1; Now you get a brand new object that lasts for a single request instead