ASP4/Mock/Pool.pm

filter: Statementstmt 73.6% 14 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 33.3% 1 / 3 totaltotal 68.9% 20 / 29 CC 1 SCAR 2.5
CC
1
Cov
74%
cleanup_register
2.0
__ANON__
2.0
call_cleanup_handlers
1.0
CRAP 1.3
« ASP4/Mock/Connection.pm ↑ Summary ASP4/Mock/ClientSocket.pm »
1  
2 package ASP4::Mock::Pool;
3  
4 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use warnings 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub new { return bless { cleanup_handlers => [ ] }, shift }
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
8 sub call_cleanup_handlers {
9 1 ▶ my $s = shift;
Subroutine call_cleanup_handlers: called CC=1 SCAR=0.2
Pod undocumented
10 1 map { $_->( ) } @{ $s->{cleanup_handlers} }
11 }
12 sub cleanup_register {
13 0 ▶ my ($s, $handler, $args) = @_;
Subroutine cleanup_register: not called CC=1 SCAR=6.9
Pod documented
14
15 0 ▶ push @{ $s->{cleanup_handlers} }, sub { $handler->( $args ) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
16 }
17  
18 sub DESTROY
19 {
20 1 ▶ my $s = shift;
Subroutine DESTROY: called CC=1 SCAR=0.0
21 1 $s->call_cleanup_handlers();
22 1 undef(%$s);
23 }# end DESTROY()
24  
25 8 1;# return true:
26  
27 =pod
28  
29 =head1 NAME
30  
31 ASP4::Mock::Pool - Mimics the $r->pool APR::Pool object
32  
33 =head1 SYNOPSIS
34  
35 my $pool = $r->pool;
36 $pool->cleanup_register( sub { ... }, \@args );
37  
38 =head1 DESCRIPTION
39  
40 This package mimics the L<APR::Pool> object obtained via $r->pool in a normal mod_perl2 environment.
41  
42 =head1 PUBLIC METHODS
43  
44 =head2 cleanup_register( sub { ... }, \@args )
45  
46 Causes the subref to be executed with C<\@args> at the end of the current request.
47  
48 =cut
49  
« ASP4/Mock/Connection.pm ↑ Summary ASP4/Mock/ClientSocket.pm »