File Coverage

blib/lib/Apache2/ASP/Mock/Pool.pm
Criterion Covered Total %
statement 6 15 40.0
branch n/a
condition n/a
subroutine 2 6 33.3
pod 1 3 33.3
total 9 24 37.5


line stmt bran cond sub pod time code
1              
2             package Apache2::ASP::Mock::Pool;
3              
4 23     23   85 use strict;
  23         30  
  23         590  
5 23     23   80 use warnings 'all';
  23         35  
  23         3241  
6              
7              
8             #==============================================================================
9             sub new
10             {
11 0     0 0   return bless {_cleanup_handlers => [ ]}, shift;
12             }# end new()
13              
14              
15             #==============================================================================
16             sub cleanup_register
17             {
18 0     0 1   my ($s, $ref, $args) = @_;
19            
20 0     0     push @{$s->{_cleanup_handlers}}, sub { $ref->( $args ) };
  0            
  0            
21             }# end cleanup_register()
22              
23              
24             #==============================================================================
25             sub call_cleanup_handlers
26             {
27 0     0 0   my $s = shift;
28            
29 0           map { $_->() } @{$s->{_cleanup_handlers}};
  0            
  0            
30             }# end call_cleanup_handlers()
31              
32             1;# return true:
33              
34              
35             =pod
36              
37             =head1 NAME
38              
39             Apache2::ASP::Mock::Pool - Mimics the $r->pool APR::Pool object
40              
41             =head1 SYNOPSIS
42              
43             my $pool = $Response->context->r->pool;
44             $pool->cleanup_register( sub { ... }, \@args );
45              
46             =head1 DESCRIPTION
47              
48             This package mimics the L object obtained via $r->pool in a normal mod_perl2 environment,
49             and is used by L.
50              
51             =head1 PUBLIC METHODS
52              
53             =head2 cleanup_register( sub { ... }, \@args )
54              
55             Causes the subref to be executed with C<@args> at the end of the current request.
56            
57             =head1 BUGS
58            
59             It's possible that some bugs have found their way into this release.
60            
61             Use RT L to submit bug reports.
62            
63             =head1 HOMEPAGE
64            
65             Please visit the Apache2::ASP homepage at L to see examples
66             of Apache2::ASP in action.
67              
68             =head1 AUTHOR
69              
70             John Drago
71              
72             =head1 COPYRIGHT
73              
74             Copyright 2008 John Drago. All rights reserved.
75              
76             =head1 LICENSE
77              
78             This software is Free software and is licensed under the same terms as perl itself.
79              
80             =cut
81