small fixes in POD
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / Service / WithAcceptContext.pm
CommitLineData
a6c13ff4 1package Catalyst::IOC::Service::WithAcceptContext;
5fabf3ec 2use Moose::Role;
3
5fabf3ec 4with 'Bread::Board::Service';
5
6has accept_context_sub => (
7 is => 'ro',
8 isa => 'Str',
9 default => 'ACCEPT_CONTEXT',
10);
11
12around 'get' => sub {
17fe1041 13 my $orig = shift;
14 my $self = shift;
5fabf3ec 15
17fe1041 16 my $instance = $self->$orig(@_);
38215fbf 17
17fe1041 18 my $accept_context_args = $self->param('accept_context_args');
19 my $ac_sub = $self->accept_context_sub;
5fabf3ec 20
a42c4b8a 21 if ( $accept_context_args && $instance->can($ac_sub) ) {
4f38bf4b 22 return $instance->$ac_sub( @$accept_context_args );
5fabf3ec 23 }
24
25 return $instance;
26};
27
28no Moose::Role;
291;
bf3c8088 30
31__END__
32
33=pod
34
35=head1 NAME
36
17fe1041 37Catalyst::Service::WithAcceptContext
bf3c8088 38
39=head1 DESCRIPTION
40
1ab07ed4 41=head1 ATTRIBUTES
bf3c8088 42
1ab07ed4 43=head2 accept_context_sub
bf3c8088 44
e8ed391e 45=head1 AUTHORS
bf3c8088 46
e8ed391e 47Catalyst Contributors, see Catalyst.pm
bf3c8088 48
e8ed391e 49=head1 COPYRIGHT
bf3c8088 50
e8ed391e 51This library is free software. You can redistribute it and/or modify it under
52the same terms as Perl itself.
bf3c8088 53
54=cut