| Catalyst-Plugin-RunAfterRequest documentation | Contained in the Catalyst-Plugin-RunAfterRequest distribution. |
Catalyst::Model::Role::RunAfterRequest - run code after the response has been sent
See Catalyst::Plugin::RunAfterRequest for full documentation.
This software is copyright (c) 2010 by Matt S Trout.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Catalyst-Plugin-RunAfterRequest documentation | Contained in the Catalyst-Plugin-RunAfterRequest distribution. |
package Catalyst::Model::Role::RunAfterRequest; BEGIN { $Catalyst::Model::Role::RunAfterRequest::AUTHORITY = 'cpan:FLORA'; } BEGIN { $Catalyst::Model::Role::RunAfterRequest::VERSION = '0.04'; } # ABSTRACT: run code after the response has been sent use Moose::Role; use Catalyst::Component::InstancePerContext; with 'Catalyst::Component::InstancePerContext'; has '_context' => ( is => 'ro', weak_ref => 1 ); # no-op that the 'around' can wrap. Allows the higher up model to implement # their own 'build_per_context_instance' method. sub build_per_context_instance { return shift; } around build_per_context_instance => sub { my $orig = shift; my $self = shift; my $c = shift; $self = $self->$orig( $c, @_ ); bless( { %$self, _context => $c }, ref($self) ); }; sub _run_after_request { my $self = shift; $self->_context->run_after_request(@_); } 1; __END__