ACME/Challenge.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 2 / 2 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 2 totaltotal 95.8% 46 / 48 CC 4 SCAR 5.1
CC
4
Cov
100%
new
3.0
status
2.0
BEGIN
1.0
CRAP 1.7
« ACME/Crypt.pm ↑ Summary ACME/X/OverloadBase.pm »
1 package Net::ACME::Challenge;
2  
3 =encoding utf-8
4  
5 =head1 NAME
6  
7 Net::ACME::Challenge - a resolved/handled challenge
8  
9 =head1 SYNOPSIS
10  
11 use Net::ACME::Challenge ();
12  
13 #This is minimal for now.
14 my $challenge = Net::ACME::Challenge->new(
15 status => 'invalid', #or 'valid'
16 error => $error_object, #likely undef if status == “valid”
17 );
18  
19 =head1 DESCRIPTION
20  
21 This module abstracts details of a handled/resolved challenge, whether
22 that challenge was met successfully or not.
23  
24 To work with unhandled/unresolved challenges, see
25 (subclasses of) C<Net::ACME::Challenge::Pending>.
26  
27 =cut
28  
29 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 8 ▶use parent qw( Net::ACME::AccessorBase );
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 8 ▶use constant _ACCESSORS => qw( error status );
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 8 ▶use Net::ACME::Utils ();
Subroutine BEGIN: called CC=1 SCAR=0.0
37 8 ▶use Net::ACME::X ();
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 8 my $ERROR_CLASS;
40  
41 8 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
42 8 $ERROR_CLASS = 'Net::ACME::Error';
43 }
44  
45 5 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
46 5 my ( $class, %opts ) = @_;
47  
48 5 ▶ if ( $opts{'error'} && !Net::ACME::Utils::thing_isa($opts{'error'}, $ERROR_CLASS) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"error"} and not Net::ACME::Utils::thing_isa($opts{"error"}, $ERROR_CLASS)) 1 4 5
Condition100%3/3
$opts{"error"} and not Net::ACME::Utils::thing_isa($opts{"error"}, $ERROR_CLASS)
!ll&&!rl&&r
221
MC/DC100%2/2
$opts{"error"} and not Net::ACME::Utils::thing_isa($opts{"error"}, $ERROR_CLASS)
$opts{"error"} not Net::ACME::Utils::thing_isa($opts{"error"}, $ERROR_CLASS)
Truth table100%3/3
A and not(B)
A= $opts{"error"}B= not Net::ACME::Utils::thing_isa($opts{"error"}, $ERROR_CLASS)
ABresult
0X0
100
111
49 1 die Net::ACME::X::create( 'InvalidParameter', "“error” must be an instance of “$ERROR_CLASS”, not “$opts{'error'}”!" );
50 }
51  
52 4 return $class->SUPER::new( %opts );
53 }
54  
55 4 ▶sub status {
Subroutine status: called CC=2 SCAR=6.9
Pod undocumented
56 4 my ($self) = @_;
57 4 ▶ return $self->SUPER::status() || 'pending';
Condition100%2/2
$self->SUPER::status || 'pending'
l!l
31
MC/DC100%1/1
$self->SUPER::status || 'pending'
$self->SUPER::status
Truth table100%2/2
A
A= $self->SUPER::status
Aresult
11
00
58 }
59  
60 8 1;
« ACME/Crypt.pm ↑ Summary ACME/X/OverloadBase.pm »