don't fail silently when container_class doesn't exist
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / LifeCycle / Request.pm
index 3b277da..39468d7 100644 (file)
@@ -1,28 +1,21 @@
 package Catalyst::IOC::LifeCycle::Request;
 use Moose::Role;
 use namespace::autoclean;
+use Carp;
 with 'Bread::Board::LifeCycle';
 
 around get => sub {
     my $orig = shift;
     my $self = shift;
 
-    my $instance = $self->$orig(@_);
-
-# FIXME -
-# during setup in Catalyst.pm:
-#  - $class->setup_actions (line 3025)
-#      - $c->dispatcher->setup_actions (line 2271)
-#          - $c->components in Catalyst/Dispatcher.pm line 604
-# which boils down to line 616 in Catalyst/IOC/Container.pm
-# resolving the component _without_ the 'context' parameter.
-# Should it get the context parameter? Should all calls to a
-# ConstructorInjection service pass that parameter?
-    my $ctx = $self->param('ctx')
-        or return $instance;
+    # 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;