blib/lib/Net/DHCPv6/Option/ClientArchType.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 54 CC 3 SCAR 12.0
CC
3
Cov
0%
new
6.0
from_bytes_inner
6.0
type
2.0
CRAP 3.3
1 #!/usr/bin/false
2 # ABSTRACT: Client System Architecture Type option (code 61) — 16-bit architecture type
3 # PODNAME: Net::DHCPv6::Option::ClientArchType
4 package Net::DHCPv6::Option::ClientArchType;
5 $Net::DHCPv6::Option::ClientArchType::VERSION = '0.001';
6 use strictures 2;
7 use Carp qw(croak);
8 use Net::DHCPv6::Constants;
9 use Net::DHCPv6::X::BadOption;
10 use parent 'Net::DHCPv6::Option';
11 use namespace::clean;
12  
13 sub new {
14 my ( $class, %args ) = @_;
15 croak 'ClientArchType requires type' unless defined $args{type};
16 $args{code} = $OPTION_CLIENT_ARCH_TYPE;
17 $args{data} = pack( 'n', $args{type} );
18 my $self = $class->SUPER::new( %args );
19 $self->{type} = $args{type};
20 bless $self, $class;
21 }
22  
23 sub type { shift->{type} }
24  
25 sub from_bytes_inner {
26 my ( $class, $code, $data ) = @_;
27 Net::DHCPv6::X::BadOption->throw( message => 'ClientArchType must be exactly 2 bytes' )
28 if CORE::length( $data ) != 2;
29 my $type = unpack( 'n', $data );
30 return $class->new( type => $type );
31 }
32  
33 sub as_bytes {
34 my $self = shift;
35 my $data = pack( 'n', $self->{type} );
36 return pack( 'nn', $self->{code}, CORE::length( $data ) ) . $data;
37 }
38  
39 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_CLIENT_ARCH_TYPE} = __PACKAGE__;
40 1;
41  
42 __END__