| 1 | |||
| 2 | package ASP4::Mock::Connection; | ||
| 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 | 8 | ▶ | use ASP4::Mock::ClientSocket; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | sub new { | ||
| 9 | 1 | ▶ | my $s = bless { |
|
Subroutine
new: called CC=1 SCAR=0.2
Pod
undocumented
| |||
| 10 | aborted => 0, | ||
| 11 | client_socket => ASP4::Mock::ClientSocket->new() | ||
| 12 | }, shift; | ||
| 13 | $s->{client_socket}->on_close(sub { | ||
| 14 | 0 | ▶ | $s->{aborted} = 0; |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 15 | 1 | }); | |
| 16 | |||
| 17 | 1 | return $s; | |
| 18 | } | ||
| 19 | |||
| 20 | 0 | ▶ | sub aborted { shift->{aborted} } |
|
Subroutine
aborted: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 21 | 0 | ▶ | sub client_socket { shift->{client_socket} } |
|
Subroutine
client_socket: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 22 | |||
| 23 | 8 | 1;# return true: | |
| 24 | |||
| 25 | =pod | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | ASP4::Mock::Connection - Mimic the Apache2::Connection object | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | my $connection = $r->connection; | ||
| 34 | |||
| 35 | if( $connection->aborted ) { | ||
| 36 | # The connection has been closed: | ||
| 37 | } | ||
| 38 | |||
| 39 | my $socket = $connection->client_socket; | ||
| 40 | |||
| 41 | =head1 DESCRIPTION | ||
| 42 | |||
| 43 | Minimal mimic of the L<Apache2::Connection> object. | ||
| 44 | |||
| 45 | =head1 PUBLIC PROPERTIES | ||
| 46 | |||
| 47 | =head2 aborted( ) | ||
| 48 | |||
| 49 | Returns true or false, if the current connection has been aborted or not - respectively. | ||
| 50 | |||
| 51 | =head2 client_socket( ) | ||
| 52 | |||
| 53 | Returns an instance of L<ASP4::Mock::ClientSocket>. | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||