| line | stmt | bran | cond | sub | pod | time | code | 
| 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 | 24 |  |  | 24 |  | 21562 | use Moose; | 
|  | 24 |  |  |  |  | 57 |  | 
|  | 24 |  |  |  |  | 201 |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | with 'Net::ISC::DHCPd::Config::Role'; | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | # not sure how I feel about the overload.  I would rather coerce the values | 
| 28 |  |  |  |  |  |  | # into a Mac type, but I want case preserved from input to output.  I only | 
| 29 |  |  |  |  |  |  | # want comparisions to be insensitive. | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 24 |  |  |  |  | 307 | use overload '==' => \&myequals, | 
| 32 |  |  |  |  |  |  | 'eq' => \&myequals, | 
| 33 | 24 |  |  | 24 |  | 165834 | q("") => \&get_value; | 
|  | 24 |  |  |  |  | 66 |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =head1 ATTRIBUTES | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =head2 myequals | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | equality check overload for case insensitive comparision | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =cut | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub myequals { | 
| 44 | 1 |  |  | 1 | 1 | 31 | return (uc($_[0]->value) eq uc($_[1])); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =head2 get_value | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | for overload q("") | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =cut | 
| 52 |  |  |  |  |  |  |  | 
| 53 | 0 |  |  | 0 | 1 | 0 | sub get_value { uc(shift->value) } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =head2 value | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | Value of the option - See L</DESCRIPTION> for details. | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =cut | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | has value => ( | 
| 62 |  |  |  |  |  |  | is => 'ro', | 
| 63 |  |  |  |  |  |  | isa => 'Str', | 
| 64 |  |  |  |  |  |  | ); | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =head2 regex | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | See L<Net::ISC::DHCPd::Config::Role/regex>. | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =cut | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 27 |  |  | 27 | 1 | 246 | sub regex { qr{^\s* hardware \s+ ethernet \s+ (.*) ;}x } | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =head1 METHODS | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =head2 captured_to_args | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =cut | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | sub captured_to_args { | 
| 83 | 12 |  |  | 12 | 1 | 30 | my $value  = shift; | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | return { | 
| 86 | 12 |  |  |  |  | 53 | value  => $value, | 
| 87 |  |  |  |  |  |  | }; | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head2 generate | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | See L<Net::ISC::DHCPd::Config::Role/generate>. | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =cut | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | sub generate { | 
| 97 | 2 |  |  | 2 | 1 | 5 | my $self  = shift; | 
| 98 | 2 |  |  |  |  | 75 | return sprintf qq(hardware ethernet %s;), $self->value; | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =head1 AUTHOR | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | See L<Net::ISC::DHCPd>. | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =cut | 
| 108 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 109 |  |  |  |  |  |  | 1; |