| 1 | package Net::ISC::DHCPd::Config::Range6; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Net::ISC::DHCPd::Config::Range6 - Range6 config parameter | ||||||||||
| 6 | |||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||
| 8 | |||||||||||
| 9 | See L<Net::ISC::DHCPd::Config::Role> for methods and attributes without | ||||||||||
| 10 | documentation. | ||||||||||
| 11 | |||||||||||
| 12 | An instance from this class, comes from / will produce: | ||||||||||
| 13 | |||||||||||
| 14 | range6 $lower_attribute_value $upper_attribute_value; | ||||||||||
| 15 | |||||||||||
| 16 | or | ||||||||||
| 17 | |||||||||||
| 18 | range6 $lower_attribute_value temporary; | ||||||||||
| 19 | |||||||||||
| 20 | =head1 SYNOPSIS | ||||||||||
| 21 | |||||||||||
| 22 | See L<Net::ISC::DHCPd::Config/SYNOPSIS>. | ||||||||||
| 23 | |||||||||||
| 24 | =head1 NOTES | ||||||||||
| 25 | |||||||||||
| 26 | L</upper> and L</lower> attributes might change from L<NetAddr::IP> to | ||||||||||
| 27 | plain strings in the future. | ||||||||||
| 28 | |||||||||||
| 29 | =cut | ||||||||||
| 30 | |||||||||||
| 31 | 27 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | 27 | ▶ | use NetAddr::IP qw(:lower); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | |||||||||||
| 34 | 27 | with 'Net::ISC::DHCPd::Config::Role'; | |||||||||
| 35 | |||||||||||
| 36 | =head1 ATTRIBUTES | ||||||||||
| 37 | |||||||||||
| 38 | =head2 upper | ||||||||||
| 39 | |||||||||||
| 40 | This attribute holds a L<NetAddr::IP> object, representing the | ||||||||||
| 41 | highest IP address in the range. | ||||||||||
| 42 | |||||||||||
| 43 | =cut | ||||||||||
| 44 | |||||||||||
| 45 | 27 | has upper => ( | |||||||||
| 46 | is => 'ro', | ||||||||||
| 47 | isa => 'Object', | ||||||||||
| 48 | ); | ||||||||||
| 49 | |||||||||||
| 50 | =head2 lower | ||||||||||
| 51 | |||||||||||
| 52 | This attribute holds a L<NetAddr::IP> object, representing the | ||||||||||
| 53 | lowest IP address in the range. | ||||||||||
| 54 | |||||||||||
| 55 | =cut | ||||||||||
| 56 | |||||||||||
| 57 | 27 | has lower => ( | |||||||||
| 58 | is => 'ro', | ||||||||||
| 59 | isa => 'Object', | ||||||||||
| 60 | ); | ||||||||||
| 61 | |||||||||||
| 62 | =head2 temporary | ||||||||||
| 63 | |||||||||||
| 64 | In place of an upper address range, you can specify that the range is for | ||||||||||
| 65 | temporary addresses and it will be used like RFC4941 | ||||||||||
| 66 | |||||||||||
| 67 | =cut | ||||||||||
| 68 | |||||||||||
| 69 | 27 | has temporary => ( | |||||||||
| 70 | is => 'ro', | ||||||||||
| 71 | isa => 'Bool', | ||||||||||
| 72 | ); | ||||||||||
| 73 | |||||||||||
| 74 | =head2 regex | ||||||||||
| 75 | |||||||||||
| 76 | See L<Net::ISC::DHCPd::Config::Role/regex>. | ||||||||||
| 77 | |||||||||||
| 78 | =cut | ||||||||||
| 79 | |||||||||||
| 80 | 27 | our $regex = qr{^\s* range6 \s+ (\S+) \s+ (\S*) \s* ;}x; | |||||||||
| 81 | |||||||||||
| 82 | =head1 METHODS | ||||||||||
| 83 | |||||||||||
| 84 | =head2 captured_to_args | ||||||||||
| 85 | |||||||||||
| 86 | See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. | ||||||||||
| 87 | |||||||||||
| 88 | =cut | ||||||||||
| 89 | |||||||||||
| 90 | 2 | ▶ | sub captured_to_args { | ||||||||
|
Subroutine
captured_to_args: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 91 | 2 | my $args; | |||||||||
| 92 | 2 | $args->{'temporary'}=0; | |||||||||
| 93 | 2 | ▶ | if ($_[1] eq 'temporary') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 94 | 1 | $args->{'temporary'}=1; | |||||||||
| 95 | } else { | ||||||||||
| 96 | 1 | $args->{'upper'}=NetAddr::IP->new($_[1]); | |||||||||
| 97 | } | ||||||||||
| 98 | 2 | $args->{'lower'}=NetAddr::IP->new($_[0]); | |||||||||
| 99 | |||||||||||
| 100 | 2 | return $args; | |||||||||
| 101 | } | ||||||||||
| 102 | |||||||||||
| 103 | =head2 generate | ||||||||||
| 104 | |||||||||||
| 105 | See L<Net::ISC::DHCPd::Config::Role/generate>. | ||||||||||
| 106 | |||||||||||
| 107 | =cut | ||||||||||
| 108 | |||||||||||
| 109 | 2 | ▶ | sub generate { | ||||||||
|
Subroutine
generate: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 110 | 2 | my $self = shift; | |||||||||
| 111 | 2 | ▶ | return 'range6 ' .$self->lower->short .' '. ($self->temporary ? 'temporary' : $self->upper->short) .';'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 112 | } | ||||||||||
| 113 | |||||||||||
| 114 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 115 | |||||||||||
| 116 | =head1 AUTHOR | ||||||||||
| 117 | |||||||||||
| 118 | See L<Net::ISC::DHCPd>. | ||||||||||
| 119 | |||||||||||
| 120 | =cut | ||||||||||
| 121 | |||||||||||
| 122 | 27 | __PACKAGE__->meta->make_immutable; | |||||||||
| 123 | |||||||||||
| 124 | 27 | 1; | |||||||||