WithParameters FIXME
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / LifeCycle / Request.pm
1 package Catalyst::IOC::LifeCycle::Request;
2 use Moose::Role;
3 use namespace::autoclean;
4 with 'Bread::Board::LifeCycle::Singleton';
5
6 around get => sub {
7     my $orig = shift;
8     my $self = shift;
9
10     my $ctx       = $self->param('ctx');
11     my $stash_key = "__Catalyst_IOC_LifeCycle_Request_" . $self->name;
12     return $ctx->stash->{$stash_key} ||= $self->$orig(@_);
13 };
14
15 1;
16
17 __END__
18
19 =pod
20
21 =head1 NAME
22
23 Catalyst::IOC::LifeCycle::Request - Components that last for one request
24
25 =head1 SYNOPSIS
26
27 =head1 DESCRIPTION
28
29 =head1 METHODS
30
31 =head1 AUTHORS
32
33 Catalyst Contributors, see Catalyst.pm
34
35 =head1 COPYRIGHT
36
37 This library is free software. You can redistribute it and/or modify it under
38 the same terms as Perl itself.
39
40 =cut