From: André Walker Date: Wed, 10 Aug 2011 03:51:08 +0000 (-0300) Subject: For some reason, ->param doesn't work in the lifecycle. Gotta fix that later X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=2c77a89427930786f5dd14924e66764e7e7f3016 For some reason, ->param doesn't work in the lifecycle. Gotta fix that later --- diff --git a/lib/Catalyst/IOC/LifeCycle/Request.pm b/lib/Catalyst/IOC/LifeCycle/Request.pm index 76806d7..39468d7 100644 --- a/lib/Catalyst/IOC/LifeCycle/Request.pm +++ b/lib/Catalyst/IOC/LifeCycle/Request.pm @@ -8,14 +8,14 @@ around get => sub { my $orig = shift; my $self = shift; - my $instance = $self->$orig(@_); - - my $ctx = $self->param('ctx') + # FIXME - ugly, but the only way it'll work + # we should find out why + my $ctx = {@_}->{'ctx'} or confess qq/This component has a Request lifecycle.\n/ . qq/The 'ctx' parameter is mandatory./; my $stash_key = "__Catalyst_IOC_LifeCycle_Request_" . $self->name; - return $ctx->stash->{$stash_key} ||= $instance; + return $ctx->stash->{$stash_key} ||= $self->$orig(@_); }; 1;