line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Types::CIDR; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$MooseX::Types::CIDR::VERSION = '1.000000'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
33350
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
87
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'CPAN:TBR'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
429
|
use MooseX::Types -declare => ['CIDR']; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use MooseX::Types::Moose qw(Str); |
12
|
|
|
|
|
|
|
use Net::CIDR; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _validate_cidr { |
15
|
|
|
|
|
|
|
my ($str) = @_; |
16
|
|
|
|
|
|
|
return Net::CIDR::cidrvalidate($str); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
subtype CIDR, |
20
|
|
|
|
|
|
|
as Str, |
21
|
|
|
|
|
|
|
where { _validate_cidr($_) }, |
22
|
|
|
|
|
|
|
message { 'CIDR is invalid' }; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
MooseX::Types::CIDR - CIDR type for Moose classes |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package Class; |
35
|
|
|
|
|
|
|
use Moose; |
36
|
|
|
|
|
|
|
use MooseX::Types::CIDR qw(CIDR); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'cidr' => ( is => 'ro', isa => CIDR ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
package main; |
41
|
|
|
|
|
|
|
Class->new( cidr => '192.168.1.1/32' ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This module lets you constrain attributes to only contain CIDR. |
46
|
|
|
|
|
|
|
No coercion is attempted. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 EXPORT |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
None by default, you'll usually want to request C<Net::CIDR> explicitly. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SUPPORT |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
perldoc MooseX::Types::CIDR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
You can also look for information at: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
L<http://annocpan.org/dist/MooseX-Types-CIDR> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * CPAN Ratings |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/MooseX-Types-CIDR> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Types-CIDR> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * Search CPAN |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/MooseX-Types-CIDR> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=back |
79
|
|
|
|
|
|
|
|