removed FIXME, added confess()
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / LifeCycle / Request.pm
CommitLineData
2402ef14 1package Catalyst::IOC::LifeCycle::Request;
2use Moose::Role;
3use namespace::autoclean;
3bb9642f 4use Carp;
da87ad6a 5with 'Bread::Board::LifeCycle';
2402ef14 6
1a6941f5 7around get => sub {
8 my $orig = shift;
9 my $self = shift;
10
da87ad6a 11 my $instance = $self->$orig(@_);
12
da87ad6a 13 my $ctx = $self->param('ctx')
3bb9642f 14 or confess qq/This component has a Request lifecycle.\n/ .
15 qq/The 'ctx' parameter is mandatory./;
da87ad6a 16
1a6941f5 17 my $stash_key = "__Catalyst_IOC_LifeCycle_Request_" . $self->name;
da87ad6a 18 return $ctx->stash->{$stash_key} ||= $instance;
1a6941f5 19};
20
2402ef14 211;
64e06b7d 22
23__END__
24
25=pod
26
27=head1 NAME
28
29Catalyst::IOC::LifeCycle::Request - Components that last for one request
30
31=head1 SYNOPSIS
32
33=head1 DESCRIPTION
34
35=head1 METHODS
36
37=head1 AUTHORS
38
39Catalyst Contributors, see Catalyst.pm
40
41=head1 COPYRIGHT
42
43This library is free software. You can redistribute it and/or modify it under
44the same terms as Perl itself.
45
46=cut