line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Connection::Sort::proto; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
234298
|
use 5.006; |
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
5
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
506
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::Connection::Sort::proto - Sorts the connections via the connection protocol. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.0.0 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.0.0'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Net::Connection::Sort::proto; |
23
|
|
|
|
|
|
|
use Net::Connection; |
24
|
|
|
|
|
|
|
use Data::Dumper; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my @objects=( |
27
|
|
|
|
|
|
|
Net::Connection->new({ |
28
|
|
|
|
|
|
|
'foreign_host' => '3.3.3.3', |
29
|
|
|
|
|
|
|
'local_host' => '4.4.4.4', |
30
|
|
|
|
|
|
|
'foreign_port' => '22', |
31
|
|
|
|
|
|
|
'local_port' => '11132', |
32
|
|
|
|
|
|
|
'sendq' => '1', |
33
|
|
|
|
|
|
|
'recvq' => '0', |
34
|
|
|
|
|
|
|
'state' => 'LISTEN', |
35
|
|
|
|
|
|
|
'proto' => 'tcp6' |
36
|
|
|
|
|
|
|
}), |
37
|
|
|
|
|
|
|
Net::Connection->new({ |
38
|
|
|
|
|
|
|
'foreign_host' => '1.1.1.1', |
39
|
|
|
|
|
|
|
'local_host' => '2.2.2.2', |
40
|
|
|
|
|
|
|
'foreign_port' => '22', |
41
|
|
|
|
|
|
|
'local_port' => '11132', |
42
|
|
|
|
|
|
|
'sendq' => '1', |
43
|
|
|
|
|
|
|
'recvq' => '0', |
44
|
|
|
|
|
|
|
'state' => 'FIN_WAIT_2', |
45
|
|
|
|
|
|
|
'proto' => 'udp4' |
46
|
|
|
|
|
|
|
}), |
47
|
|
|
|
|
|
|
Net::Connection->new({ |
48
|
|
|
|
|
|
|
'foreign_host' => '5.5.5.5', |
49
|
|
|
|
|
|
|
'local_host' => '6.6.6.6', |
50
|
|
|
|
|
|
|
'foreign_port' => '22', |
51
|
|
|
|
|
|
|
'local_port' => '11132', |
52
|
|
|
|
|
|
|
'sendq' => '1', |
53
|
|
|
|
|
|
|
'recvq' => '0', |
54
|
|
|
|
|
|
|
'state' => 'TIME_WAIT', |
55
|
|
|
|
|
|
|
'proto' => 'udp6' |
56
|
|
|
|
|
|
|
}), |
57
|
|
|
|
|
|
|
Net::Connection->new({ |
58
|
|
|
|
|
|
|
'foreign_host' => '3.3.3.3', |
59
|
|
|
|
|
|
|
'local_host' => '4.4.4.4', |
60
|
|
|
|
|
|
|
'foreign_port' => '22', |
61
|
|
|
|
|
|
|
'local_port' => '11132', |
62
|
|
|
|
|
|
|
'sendq' => '1', |
63
|
|
|
|
|
|
|
'recvq' => '0', |
64
|
|
|
|
|
|
|
'state' => 'ESTABLISHED', |
65
|
|
|
|
|
|
|
'proto' => 'tcp4' |
66
|
|
|
|
|
|
|
}), |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $sorter=$sorter=Net::Connection::Sort::proto->new; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
@objects=$sorter->sorter( \@objects ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
print Dumper( \@objects ); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 METHODS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 new |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This initiates the module. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
No arguments are taken and this will always succeed. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $sorter=$sorter=Net::Connection::Sort::proto->new; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub new{ |
88
|
1
|
|
|
1
|
1
|
1882
|
my %args; |
89
|
1
|
50
|
|
|
|
6
|
if(defined($_[1])){ |
90
|
0
|
|
|
|
|
0
|
%args= %{$_[1]}; |
|
0
|
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
1
|
|
|
|
|
2
|
my $self = { |
95
|
|
|
|
|
|
|
}; |
96
|
1
|
|
|
|
|
2
|
bless $self; |
97
|
|
|
|
|
|
|
|
98
|
1
|
|
|
|
|
3
|
return $self; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 sort |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This sorts the array of Net::Connection objects. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
One object is taken and that is a array of objects. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
@objects=$sorter->sorter( \@objects ); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
print Dumper( \@objects ); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub sorter{ |
114
|
1
|
|
|
1
|
0
|
369
|
my $self=$_[0]; |
115
|
1
|
|
|
|
|
3
|
my @objects; |
116
|
1
|
50
|
33
|
|
|
10
|
if ( |
117
|
|
|
|
|
|
|
defined( $_[1] ) && |
118
|
|
|
|
|
|
|
( ref($_[1]) eq 'ARRAY' ) |
119
|
|
|
|
|
|
|
){ |
120
|
1
|
|
|
|
|
2
|
@objects=@{ $_[1] }; |
|
1
|
|
|
|
|
4
|
|
121
|
|
|
|
|
|
|
}else{ |
122
|
0
|
|
|
|
|
0
|
die 'The passed item is either not a array or undefined'; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
@objects=sort { |
126
|
1
|
|
|
|
|
7
|
$a->proto cmp $b->proto |
|
5
|
|
|
|
|
28
|
|
127
|
|
|
|
|
|
|
} @objects; |
128
|
|
|
|
|
|
|
|
129
|
1
|
|
|
|
|
9
|
return @objects; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHOR |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 BUGS |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
139
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
140
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 SUPPORT |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
perldoc Net::Connection::Sort |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You can also look for information at: |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=over 4 |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * CPAN Ratings |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * Search CPAN |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * Git Repo |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=back |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Zane C. Bowers-Hadley. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This is free software, licensed under: |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; # End of Net::Connection::Sort |