| 1 | #!/bin/false | ||||||||||||||||||||
| 2 | # ABSTRACT: Status Code option (code 13) | ||||||||||||||||||||
| 3 | # PODNAME: Net::DHCPv6::Option::StatusCode | ||||||||||||||||||||
| 4 | 15 | ▶ | use strictures 2; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | package Net::DHCPv6::Option::StatusCode; | ||||||||||||||||||||
| 7 | 15 | $Net::DHCPv6::Option::StatusCode::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_STATUS_CODE | ||||||||||||||||||||
| 12 | 15 | ); | |||||||||||||||||||
| 13 | 15 | ▶ | use Net::DHCPv6::X::Truncated (); | ||||||||||||||||||
|
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 | 15 | my $EMPTY = q(); | |||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 6 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||
| 19 | 6 | my ( $class, %args ) = @_; | |||||||||||||||||||
| 20 | 6 | ▶ | croak 'StatusCode requires status_code' unless defined $args{status_code}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | 5 | $args{code} = $OPTION_STATUS_CODE; | |||||||||||||||||||
| 22 | 5 | ▶ | $args{message} = $args{message} // $EMPTY; | ||||||||||||||||||
|
Condition33%1/3
$args{"message"} // $EMPTY
MC/DC0%0/2
$args{"message"} // $EMPTY
$args{"message"}
$EMPTY
Truth table33%1/3
A // B
A= $args{"message"}B= $EMPTY
| |||||||||||||||||||||
| 23 | 5 | $args{data} = pack( 'n', $args{status_code} ) . $args{message}; | |||||||||||||||||||
| 24 | 5 | my $self = $class->SUPER::new( %args ); | |||||||||||||||||||
| 25 | 5 | $self->{status_code} = $args{status_code}; | |||||||||||||||||||
| 26 | 5 | $self->{message} = $args{message}; | |||||||||||||||||||
| 27 | 5 | return bless $self, $class; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 3 | ▶ | sub status_code { return shift->{status_code} } | ||||||||||||||||||
|
Subroutine
status_code: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 31 | 3 | ▶ | sub message { return shift->{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 4 | ▶ | sub from_bytes_inner { | ||||||||||||||||||
|
Subroutine
from_bytes_inner: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 34 | 4 | my ( $class, $code, $payload ) = @_; | |||||||||||||||||||
| 35 | 4 | ▶ | Net::DHCPv6::X::Truncated->throw( message => 'Truncated StatusCode option' ) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 36 | if CORE::length( $payload ) < 2; | ||||||||||||||||||||
| 37 | 3 | my $sc = unpack( 'n', substr( $payload, 0, 2 ) ); | |||||||||||||||||||
| 38 | 3 | my $msg = substr( $payload, 2 ); | |||||||||||||||||||
| 39 | 3 | return $class->new( status_code => $sc, message => $msg ); | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 15 | $Net::DHCPv6::OptionList::OPTION_CLASS{$OPTION_STATUS_CODE} = __PACKAGE__; | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 15 | 1; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||