some playing
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / LifeCycle / Request.pm
index 39468d7..bbdde3f 100644 (file)
@@ -3,16 +3,18 @@ use Moose::Role;
 use namespace::autoclean;
 use Carp;
 with 'Bread::Board::LifeCycle';
+use Data::Dumper;
 
 around get => sub {
-    my $orig = shift;
-    my $self = shift;
-
-    # 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 $orig   = shift;
+    my $self   = shift;
+    my $params = {@_};
+
+    my $ctx = exists $params->{ctx} && ref $params->{ctx}
+            ? $params->{ctx}
+            : undef
+            ;
+    return $self->$orig(@_) unless $ctx;
 
     my $stash_key = "__Catalyst_IOC_LifeCycle_Request_" . $self->name;
     return $ctx->stash->{$stash_key} ||= $self->$orig(@_);