| 1 | # You may distribute under the terms of either the GNU General Public License | ||||||||||||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||||||||||||
| 3 | # | ||||||||||||
| 4 | # (C) Paul Evans, 2010-2020 -- leonerd@leonerd.org.uk | ||||||||||||
| 5 | |||||||||||||
| 6 | package Net::Async::Tangence::ServerProtocol 0.16; | ||||||||||||
| 7 | |||||||||||||
| 8 | 7 | ▶ | use v5.14; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 7 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 7 | ▶ | use base qw( Net::Async::Tangence::Protocol Tangence::Server ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 7 | ▶ | use mro 'c3'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | 7 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | |||||||||||||
| 16 | =head1 NAME | ||||||||||||
| 17 | |||||||||||||
| 18 | C<Net::Async::Tangence::ServerProtocol> - C<Net::Async::Tangence::Protocol> | ||||||||||||
| 19 | subclass for servers | ||||||||||||
| 20 | |||||||||||||
| 21 | =head1 DESCRIPTION | ||||||||||||
| 22 | |||||||||||||
| 23 | This subclass of L<Net::Async::Tangence::Protocol> provides additional logic | ||||||||||||
| 24 | required by the server side of a connection. It is not intended to be directly | ||||||||||||
| 25 | used by server implementations. | ||||||||||||
| 26 | |||||||||||||
| 27 | =cut | ||||||||||||
| 28 | |||||||||||||
| 29 | sub _init | ||||||||||||
| 30 | 7 | ▶ | { | ||||||||||
|
Subroutine
_init: called CC=2 SCAR=7.0
| |||||||||||||
| 31 | 7 | my $self = shift; | |||||||||||
| 32 | 7 | my ( $params ) = @_; | |||||||||||
| 33 | |||||||||||||
| 34 | 7 | $self->registry( delete $params->{registry} ); | |||||||||||
| 35 | |||||||||||||
| 36 | 7 | ▶ | $params->{on_closed} ||= undef; | ||||||||||
|
Condition50%1/2
$params->{"on_closed"} ||= undef
MC/DC0%0/1
$params->{"on_closed"} ||= undef
$params->{"on_closed"}
Truth table50%1/2
A
A= $params->{"on_closed"}
| |||||||||||||
| 37 | |||||||||||||
| 38 | 7 | $self->SUPER::_init( $params ); | |||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | sub configure | ||||||||||||
| 42 | 15 | ▶ | { | ||||||||||
|
Subroutine
configure: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 43 | 15 | my $self = shift; | |||||||||||
| 44 | 15 | my %params = @_; | |||||||||||
| 45 | |||||||||||||
| 46 | 15 | ▶ | if( exists $params{on_closed} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 47 | 8 | my $on_closed = $params{on_closed}; | |||||||||||
| 48 | 3 | ▶ | $params{on_closed} = sub { | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||
| 49 | 3 | my $self = shift; | |||||||||||
| 50 | |||||||||||||
| 51 | 3 | ▶ | $on_closed->( $self ) if $on_closed; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | 8 | }; | |||||||||||
| 53 | } | ||||||||||||
| 54 | |||||||||||||
| 55 | 15 | $self->SUPER::configure( %params ); | |||||||||||
| 56 | } | ||||||||||||
| 57 | |||||||||||||
| 58 | sub rootobj | ||||||||||||
| 59 | 7 | ▶ | { | ||||||||||
|
Subroutine
rootobj: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 60 | 7 | my $self = shift; | |||||||||||
| 61 | 7 | my ( $identity ) = @_; | |||||||||||
| 62 | |||||||||||||
| 63 | 7 | return $self->parent->conn_rootobj( $self, $identity ); | |||||||||||
| 64 | } | ||||||||||||
| 65 | |||||||||||||
| 66 | sub permit_registry | ||||||||||||
| 67 | 7 | ▶ | { | ||||||||||
|
Subroutine
permit_registry: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 68 | 7 | my $self = shift; | |||||||||||
| 69 | 7 | return $self->parent->conn_permits_registry( $self ); | |||||||||||
| 70 | } | ||||||||||||
| 71 | |||||||||||||
| 72 | =head1 AUTHOR | ||||||||||||
| 73 | |||||||||||||
| 74 | Paul Evans <leonerd@leonerd.org.uk> | ||||||||||||
| 75 | |||||||||||||
| 76 | =cut | ||||||||||||
| 77 | |||||||||||||
| 78 | 7 | 0x55AA; | |||||||||||