line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Types::PortNumber; |
2
|
1
|
|
|
1
|
|
28576
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
75
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
our $AUTHORITY = 'CPAN:TBR'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
463
|
use MooseX::Types -declare => [qw(PortNumber PortWellKnow PortRegistered PortPrivate)]; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use MooseX::Types::Moose qw(Int); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
subtype PortNumber, |
12
|
|
|
|
|
|
|
as Int, |
13
|
|
|
|
|
|
|
where { $_ >= 0 && $_ <= 65535 }, |
14
|
|
|
|
|
|
|
message { 'Ports are those from 0 through 65535' }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
subtype PortWellKnow, |
17
|
|
|
|
|
|
|
as Int, |
18
|
|
|
|
|
|
|
where { $_ >= 0 && $_ <= 1023 }, |
19
|
|
|
|
|
|
|
message { 'The Well Known Ports are those from 0 through 1023.' }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
subtype PortRegistered, |
22
|
|
|
|
|
|
|
as Int, |
23
|
|
|
|
|
|
|
where { $_ >= 1024 && $_ <= 49151 }, |
24
|
|
|
|
|
|
|
message { 'The Registered Ports are those from 1024 through 49151' }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
subtype PortPrivate, |
27
|
|
|
|
|
|
|
as Int, |
28
|
|
|
|
|
|
|
where { $_ >= 49152 && $_ <= 65535 }, |
29
|
|
|
|
|
|
|
message { 'The Dynamic and/or Private Ports are those from 49152 through 65535' }; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MooseX::Types::PortNumber - Port number type for moose classes by The Internet Assigned Numbers Authority (IANA). |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
package MyClass; |
43
|
|
|
|
|
|
|
use Moose; |
44
|
|
|
|
|
|
|
use MooseX::Types::PortNumber qw/PortNumber PortWellKnow PortRegistered PortPrivate/; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has port => ( isa => PortNumber, is => 'ro' ); |
47
|
|
|
|
|
|
|
has well => ( isa => PortWellKnow, is => 'ro'); |
48
|
|
|
|
|
|
|
has reg => ( isa => PortRegistered, is => 'ro'); |
49
|
|
|
|
|
|
|
has priv => ( isa => PortPrivate, is => 'ro'); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The port numbers are divided into three ranges: the Well Known Ports, |
54
|
|
|
|
|
|
|
the Registered Ports, and the Dynamic and/or Private Ports. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The Well Known Ports are those from 0 through 1023. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
DCCP Well Known ports SHOULD NOT be used without IANA registration. |
59
|
|
|
|
|
|
|
The registration procedure is defined in [RFC4340], Section 19.9. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The Registered Ports are those from 1024 through 49151 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
DCCP Registered ports SHOULD NOT be used without IANA registration. |
64
|
|
|
|
|
|
|
The registration procedure is defined in [RFC4340], Section 19.9. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The Dynamic and/or Private Ports are those from 49152 through 65535 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
http://www.iana.org/assignments/port-numbers |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Thiago Rondon C<< <thiago@aware.com.br> >> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Aware TI (L<http://www.aware.com.br/>) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This program is Free software, you may redistribute it under the same |
81
|
|
|
|
|
|
|
terms as Perl itself. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|