lib/Net/DHCPv6/Option/ElapsedTime.pm

filter: Statementstmt 100% 36 / 36 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 100% 53 / 53 CC 3 SCAR 2.9
CC
3
Cov
100%
new
2.0
from_bytes_inner
2.0
BEGIN
1.0
CRAP 1.3
« lib/Net/DHCPv6/Option/ClientArchType.pm ↑ Summary lib/Net/DHCPv6/Option/MudUrl.pm »
1 #!/bin/false
2 # ABSTRACT: Elapsed Time option (code 8) -- 16-bit centiseconds
3 # PODNAME: Net::DHCPv6::Option::ElapsedTime
4 15 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Net::DHCPv6::Option::ElapsedTime;
7 15 $Net::DHCPv6::Option::ElapsedTime::VERSION = '0.003';
8 15 ▶use Net::DHCPv6::OptionList ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use Net::DHCPv6::Constants qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
11 $OPTION_ELAPSED_TIME
12 15 );
13 15 ▶use Net::DHCPv6::X::BadOption ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 15 ▶use parent 'Net::DHCPv6::Option';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 15 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 29 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
18 29 my ( $class, %args ) = @_;
19 29 ▶ croak 'ElapsedTime requires centiseconds' unless defined $args{centiseconds};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"centiseconds"} 1 28 29
20 28 $args{code} = $OPTION_ELAPSED_TIME;
21 28 $args{data} = pack( 'n', $args{centiseconds} );
22 28 my $self = $class->SUPER::new( %args );
23 28 $self->{centiseconds} = $args{centiseconds};
24 28 return bless $self, $class;
25 }
26  
27 11 ▶sub centiseconds { return shift->{centiseconds} }
Subroutine centiseconds: called CC=1 SCAR=0.0
Pod documented
28  
29 27 ▶sub from_bytes_inner {
Subroutine from_bytes_inner: called CC=2 SCAR=6.9
Pod documented
30 27 my ( $class, $code, $payload ) = @_;
31 27 ▶ Net::DHCPv6::X::BadOption->throw( message => 'ElapsedTime option must be exactly 2 bytes' )
Branch: 1 branch
BranchTrueFalseTotal
if length $payload != 2 1 26 27
32 if CORE::length( $payload ) != 2;
33 26 my $cs = unpack( 'n', $payload );
34 26 return $class->new( centiseconds => $cs );
35 }
36  
37 15 $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_ELAPSED_TIME} = __PACKAGE__;
38  
39 15 1;
40  
41 __END__
« lib/Net/DHCPv6/Option/ClientArchType.pm ↑ Summary lib/Net/DHCPv6/Option/MudUrl.pm »