line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Farly::Transport::Protocol;
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
38983
|
use 5.008008;
|
|
17
|
|
|
|
|
61
|
|
|
17
|
|
|
|
|
823
|
|
4
|
17
|
|
|
17
|
|
109
|
use strict;
|
|
17
|
|
|
|
|
30
|
|
|
17
|
|
|
|
|
559
|
|
5
|
17
|
|
|
17
|
|
93
|
use warnings;
|
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
488
|
|
6
|
17
|
|
|
17
|
|
89
|
use Carp;
|
|
17
|
|
|
|
|
29
|
|
|
17
|
|
|
|
|
9304
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.26';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new {
|
11
|
471
|
|
|
471
|
1
|
948
|
my ( $class, $protocol ) = @_;
|
12
|
|
|
|
|
|
|
|
13
|
471
|
50
|
|
|
|
1255
|
confess "protocol number required" unless ( defined $protocol );
|
14
|
|
|
|
|
|
|
|
15
|
471
|
|
|
|
|
889
|
$protocol =~ s/\s+//g;
|
16
|
|
|
|
|
|
|
|
17
|
471
|
50
|
|
|
|
1925
|
confess "$protocol is not a number"
|
18
|
|
|
|
|
|
|
unless ( $protocol =~ /^\d+$/ );
|
19
|
|
|
|
|
|
|
|
20
|
471
|
50
|
33
|
|
|
2766
|
confess "invalid protocol $protocol"
|
21
|
|
|
|
|
|
|
unless ( ( $protocol >= 0 && $protocol <= 255 ) );
|
22
|
|
|
|
|
|
|
|
23
|
471
|
|
|
|
|
2241
|
return bless( \$protocol, $class );
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub protocol {
|
27
|
980
|
|
|
980
|
1
|
899
|
return ${ $_[0] };
|
|
980
|
|
|
|
|
4465
|
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub as_string {
|
31
|
204
|
|
|
204
|
1
|
333
|
return ${ $_[0] };
|
|
204
|
|
|
|
|
836
|
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub equals {
|
35
|
592
|
|
|
592
|
1
|
814
|
my ( $self, $other ) = @_;
|
36
|
|
|
|
|
|
|
|
37
|
592
|
100
|
|
|
|
2640
|
if ( $other->isa('Farly::Transport::Protocol') ) {
|
38
|
|
|
|
|
|
|
|
39
|
459
|
|
|
|
|
800
|
return $self->protocol() == $other->protocol();
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub contains {
|
44
|
38
|
|
|
38
|
1
|
53
|
my ( $self, $other ) = @_;
|
45
|
|
|
|
|
|
|
|
46
|
38
|
50
|
|
|
|
145
|
if ( $other->isa('Farly::Transport::Protocol') ) {
|
47
|
|
|
|
|
|
|
|
48
|
38
|
100
|
|
|
|
66
|
if ( $self->protocol() == 0 ) {
|
49
|
4
|
|
|
|
|
28
|
return 1;
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
|
52
|
34
|
|
|
|
|
69
|
return $self->equals($other);
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub intersects {
|
57
|
3
|
|
|
3
|
1
|
6
|
my ( $self, $other ) = @_;
|
58
|
|
|
|
|
|
|
|
59
|
3
|
100
|
100
|
|
|
7
|
if ( $self->contains($other) || $other->contains($self) ) {
|
60
|
2
|
|
|
|
|
8
|
return 1;
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub compare {
|
65
|
12
|
|
|
12
|
0
|
24
|
my ( $self, $other ) = @_;
|
66
|
|
|
|
|
|
|
|
67
|
12
|
50
|
|
|
|
64
|
if ( $other->isa('Farly::Transport::Protocol') ) {
|
68
|
12
|
|
|
|
|
33
|
return $self->protocol() <=> $other->protocol();
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1;
|
73
|
|
|
|
|
|
|
__END__
|