ASP/Mock/Pool.pm

filter: Statementstmt 43.7% 7 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 33.3% 1 / 3 totaltotal 40.0% 10 / 25 CC 1 SCAR 5.1
CC
1
Cov
44%
new
2.0
cleanup_register
2.0
__ANON__
2.0
CRAP 1.7
« ASP/TransHandler.pm ↑ Summary ASP/Mock/ClientSocket.pm »
1  
2 package Apache2::ASP::Mock::Pool;
3  
4 23 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 23 ▶use warnings 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 #==============================================================================
9 sub new
10 {
11 0 ▶ return bless {_cleanup_handlers => [ ]}, shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
12 }# end new()
13  
14  
15 #==============================================================================
16 sub cleanup_register
17 {
18 0 ▶ my ($s, $ref, $args) = @_;
Subroutine cleanup_register: not called CC=1 SCAR=6.9
Pod documented
19
20 0 ▶ push @{$s->{_cleanup_handlers}}, sub { $ref->( $args ) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 }# end cleanup_register()
22  
23  
24 #==============================================================================
25 sub call_cleanup_handlers
26 {
27 0 ▶ my $s = shift;
Subroutine call_cleanup_handlers: not called CC=1 SCAR=6.9
Pod undocumented
28
29 0 map { $_->() } @{$s->{_cleanup_handlers}};
30 }# end call_cleanup_handlers()
31  
32 23 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<APR::Pool> object obtained via $r->pool in a normal mod_perl2 environment,
49 and is used by L<Apace2::ASP::API>.
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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP> to submit bug reports.
62
63 =head1 HOMEPAGE
64
65 Please visit the Apache2::ASP homepage at L<http://www.devstack.com/> to see examples
66 of Apache2::ASP in action.
67  
68 =head1 AUTHOR
69  
70 John Drago <jdrago_999@yahoo.com>
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  
« ASP/TransHandler.pm ↑ Summary ASP/Mock/ClientSocket.pm »