Commit | Line | Data |
2402ef14 |
1 | package Catalyst::IOC::LifeCycle::Request; |
2 | use Moose::Role; |
3 | use namespace::autoclean; |
2402ef14 |
4 | with 'Bread::Board::LifeCycle::Singleton'; |
5 | |
1a6941f5 |
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 | |
2402ef14 |
15 | 1; |
64e06b7d |
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 |