| 1 | |||
| 2 | package ASP4::Mock::Pool; | ||
| 3 | |||
| 4 | 15 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 15 | ▶ | use warnings 'all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 5145 | ▶ | sub new { return bless { cleanup_handlers => [ ] }, shift } |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 8 | 5129 | ▶ | sub call_cleanup_handlers { |
|
Subroutine
call_cleanup_handlers: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 9 | 5129 | my $s = shift; | |
| 10 | 5129 | map { $_->( ) } @{ $s->{cleanup_handlers} } | |
| 11 | } | ||
| 12 | 1 | ▶ | sub cleanup_register { |
|
Subroutine
cleanup_register: called CC=1 SCAR=0.0
Pod
documented
| |||
| 13 | 1 | my ($s, $handler, $args) = @_; | |
| 14 | |||
| 15 | 1 | ▶ | push @{ $s->{cleanup_handlers} }, sub { $handler->( $args ) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | } | ||
| 17 | |||
| 18 | sub DESTROY | ||
| 19 | 5133 | ▶ | { |
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||
| 20 | 5133 | my $s = shift; | |
| 21 | 5133 | undef(%$s); | |
| 22 | }# end DESTROY() | ||
| 23 | |||
| 24 | 15 | 1;# return true: | |
| 25 | |||
| 26 | =pod | ||
| 27 | |||
| 28 | =head1 NAME | ||
| 29 | |||
| 30 | ASP4::Mock::Pool - Mimics the $r->pool APR::Pool object | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | my $pool = $r->pool; | ||
| 35 | $pool->cleanup_register( sub { ... }, \@args ); | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | This package mimics the L<APR::Pool> object obtained via $r->pool in a normal mod_perl2 environment. | ||
| 40 | |||
| 41 | =head1 PUBLIC METHODS | ||
| 42 | |||
| 43 | =head2 cleanup_register( sub { ... }, \@args ) | ||
| 44 | |||
| 45 | Causes the subref to be executed with C<\@args> at the end of the current request. | ||
| 46 | |||
| 47 | =head1 BUGS | ||
| 48 | |||
| 49 | It's possible that some bugs have found their way into this release. | ||
| 50 | |||
| 51 | Use RT L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4> to submit bug reports. | ||
| 52 | |||
| 53 | =head1 HOMEPAGE | ||
| 54 | |||
| 55 | Please visit the ASP4 homepage at L<http://0x31337.org/code/> to see examples | ||
| 56 | of ASP4 in action. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||