X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent%2FACCEPT_CONTEXT.pm;h=1a6f0a883c6bd47e298a4d792855004b6ecce63b;hb=9087ba500246c810025823e93927f62580238e78;hp=523a4c11249683d6cb15e0714519fc9f16ba04cd;hpb=16beaa34faea61ca82bde58b02237776ff61804d;p=catagits%2FCatalyst-Component-ACCEPT_CONTEXT.git diff --git a/lib/Catalyst/Component/ACCEPT_CONTEXT.pm b/lib/Catalyst/Component/ACCEPT_CONTEXT.pm index 523a4c1..1a6f0a8 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