package Catalyst::IOC::LifeCycle::Request;
use Moose::Role;
use namespace::autoclean;
-
-# based on Bread::Board::LifeCycle::Request from OX
-# just behaves like a singleton - ::Request instances
-# will get flushed after the response is sent
with 'Bread::Board::LifeCycle::Singleton';
+around get => sub {
+ my $orig = shift;
+ my $self = shift;
+
+ my $ctx = $self->param('ctx');
+ my $stash_key = "__Catalyst_IOC_LifeCycle_Request_" . $self->name;
+ return $ctx->stash->{$stash_key} ||= $self->$orig(@_);
+};
+
1;
__END__