blib/lib/ASP4/Mock/Connection.pm

filter: Statementstmt 87.5% 14 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 50.0% 2 / 4 totaltotal 75.0% 21 / 28 CC 1 SCAR 2.2
CC
1
Cov
88%
__ANON__
2.0
client_socket
2.0
new
1.0
CRAP 1.3
« blib/lib/ASP4/HandlerRunner.pm ↑ Summary blib/lib/ASP4/OutBuffer.pm »
1  
2 package ASP4::Mock::Connection;
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 15 ▶use ASP4::Mock::ClientSocket;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5145 ▶sub new {
Subroutine new: called CC=1 SCAR=0.2
Pod undocumented
9 5145 my $s = bless {
10 aborted => 0,
11 client_socket => ASP4::Mock::ClientSocket->new()
12 }, shift;
13 0 ▶ $s->{client_socket}->on_close(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
14 0 $s->{aborted} = 0;
15 5145 });
16
17 5145 return $s;
18 }
19  
20 1103 ▶sub aborted { shift->{aborted} }
Subroutine aborted: called CC=1 SCAR=0.0
Pod documented
21 0 ▶sub client_socket { shift->{client_socket} }
Subroutine client_socket: not called CC=1 SCAR=6.9
Pod documented
22 0 ▶sub remote_addr { }
Subroutine remote_addr: not called CC=1 SCAR=0.0
Pod undocumented
23  
24 15 1;# return true:
25  
26 =pod
27  
28 =head1 NAME
29  
30 ASP4::Mock::Connection - Mimic the Apache2::Connection object
31  
32 =head1 SYNOPSIS
33  
34 my $connection = $r->connection;
35
36 if( $connection->aborted ) {
37 # The connection has been closed:
38 }
39
40 my $socket = $connection->client_socket;
41  
42 =head1 DESCRIPTION
43  
44 Minimal mimic of the L<Apache2::Connection> object.
45  
46 =head1 PUBLIC PROPERTIES
47  
48 =head2 aborted( )
49  
50 Returns true or false, if the current connection has been aborted or not - respectively.
51  
52 =head2 client_socket( )
53  
54 Returns an instance of L<ASP4::Mock::ClientSocket>.
55  
56 =head1 BUGS
57  
58 It's possible that some bugs have found their way into this release.
59  
60 Use RT L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4> to submit bug reports.
61  
62 =head1 HOMEPAGE
63  
64 Please visit the ASP4 homepage at L<http://0x31337.org/code/> to see examples
65 of ASP4 in action.
66  
67 =cut
68  
« blib/lib/ASP4/HandlerRunner.pm ↑ Summary blib/lib/ASP4/OutBuffer.pm »