| 1 | package AnyEvent::Ident::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Simple asynchronous ident response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | our $VERSION = '0.08'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 15 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 15 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 15 | ▶ | if(@_ == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 12 | my $raw = $self->{raw} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | if($raw =~ /^\s*(\d+)\s*,\s*(\d+)\s*$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 10 | ▶ | croak "invalid port" if $1 == 0 || $2 == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$1 == 0 or $2 == 0 or $1 > 65535 or $2 > 65535
$1 == 0 or $2 == 0 or $1 > 65535
$1 == 0 or $2 == 0
MC/DC50%2/4
$1 == 0 or $2 == 0 or $1 > 65535 or $2 > 65535
$1 == 0
$2 == 0
$1 > 65535
$2 > 65535
Truth table60%3/5
A or B or C or D
A= $1 == 0B= $2 == 0C= $1 > 65535D= $2 > 65535
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | || $1 > 65535 || $2 > 65535; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | ($self->{server_port}, $self->{client_port}) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | croak "bad request: $raw"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | elsif(@_ == 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | $self->{raw} = join(',', ($self->{server_port}, $self->{client_port}) = @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | croak 'usage: AnyEvent::Ident::Request->new( [ $raw | $server_port, $client_port ] )'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 11 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 17 | ▶ | sub server_port { shift->{server_port} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
server_port: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 14 | ▶ | sub client_port { shift->{client_port} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
client_port: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | ▶ | sub as_string { shift->{raw} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||