| 1 | package Net::ISC::DHCPd::Config::Host::HardwareEthernet; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Net::ISC::DHCPd::Config::Host::HardwareEthernet - Misc option 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 one of the | ||
| 13 | lines below | ||
| 14 | |||
| 15 | hardware ethernet $value_attribute_value; | ||
| 16 | |||
| 17 | =head1 SYNOPSIS | ||
| 18 | |||
| 19 | See L<Net::ISC::DHCPd::Config/SYNOPSIS>. | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | 27 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 27 | ▶ | use Net::ISC::DHCPd::Types 'Mac'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | |||
| 26 | 27 | with 'Net::ISC::DHCPd::Config::Role'; | |
| 27 | |||
| 28 | # not sure how I feel about the overload. I would rather coerce the values | ||
| 29 | # into a Mac type, but I want case preserved from input to output. I only | ||
| 30 | # want comparisions to be insensitive. | ||
| 31 | |||
| 32 | 27 | ▶ | use overload '==' => \&myequals, |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | 'eq' => \&myequals, | ||
| 34 | 27 | q("") => \&get_value; | |
| 35 | |||
| 36 | =head1 ATTRIBUTES | ||
| 37 | |||
| 38 | =head2 myequals | ||
| 39 | |||
| 40 | equality check overload for case insensitive comparision | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 0 | ▶ | sub myequals { |
|
Subroutine
myequals: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 45 | 0 | return (uc($_[0]->value) eq uc($_[1])); | |
| 46 | } | ||
| 47 | |||
| 48 | =head2 get_value | ||
| 49 | |||
| 50 | for overload q("") | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 0 | ▶ | sub get_value { uc(shift->value) } |
|
Subroutine
get_value: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 55 | |||
| 56 | =head2 value | ||
| 57 | |||
| 58 | Value of the option - See L</DESCRIPTION> for details. | ||
| 59 | |||
| 60 | =cut | ||
| 61 | |||
| 62 | 27 | has value => ( | |
| 63 | is => 'ro', | ||
| 64 | isa => Mac, | ||
| 65 | coerce => 1, | ||
| 66 | ); | ||
| 67 | |||
| 68 | =head2 regex | ||
| 69 | |||
| 70 | See L<Net::ISC::DHCPd::Config::Role/regex>. | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | 27 | our $regex = qr{^\s* hardware \s+ ethernet \s+ (.*) ;}x; | |
| 75 | |||
| 76 | =head1 METHODS | ||
| 77 | |||
| 78 | =head2 captured_to_args | ||
| 79 | |||
| 80 | See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | 11 | ▶ | sub captured_to_args { |
|
Subroutine
captured_to_args: called CC=1 SCAR=0.0
Pod
documented
| |||
| 85 | 11 | my $value = shift; | |
| 86 | |||
| 87 | return { | ||
| 88 | 11 | value => $value, | |
| 89 | }; | ||
| 90 | } | ||
| 91 | |||
| 92 | =head2 generate | ||
| 93 | |||
| 94 | See L<Net::ISC::DHCPd::Config::Role/generate>. | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | 2 | ▶ | sub generate { |
|
Subroutine
generate: called CC=1 SCAR=0.0
Pod
documented
| |||
| 99 | 2 | my $self = shift; | |
| 100 | 2 | return sprintf qq(hardware ethernet %s;), $self->value; | |
| 101 | } | ||
| 102 | |||
| 103 | =head1 COPYRIGHT & LICENSE | ||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | See L<Net::ISC::DHCPd>. | ||
| 108 | |||
| 109 | =cut | ||
| 110 | 27 | __PACKAGE__->meta->make_immutable; | |
| 111 | 27 | 1; | |