ACME/Certificate/Pending.pm

filter: Statementstmt 100% 16 / 16 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 23 / 23 CC 2 SCAR 2.9
CC
2
Cov
100%
_handle_non_202_poll
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« ACME/X/OverloadBase.pm ↑ Summary ACME/X/HashBase.pm »
1 package Net::ACME::Certificate::Pending;
2  
3 =encoding utf-8
4  
5 =head1 NAME
6  
7 Net::ACME::Certificate::Pending - for when the cert isn’t ready yet
8  
9 =head1 SYNOPSIS
10  
11 my $need_retry = Net::ACME::Certificate::Pending->new(
12 uri => 'http://path/to/cert',
13 retry_after => 30, #i.e., retry after 30 seconds
14 );
15  
16 my $cert;
17  
18 while (!$cert) {
19 if ($need_retry->is_time_to_poll()) {
20 $cert = $need_retry->poll();
21 }
22  
23 sleep 1;
24 }
25  
26 =cut
27  
28 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 7 ▶use parent qw( Net::ACME::RetryAfter );
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 7 ▶use Net::ACME::Certificate ();
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 sub _handle_non_202_poll {
36 4 ▶ my ( $self, $resp ) = @_;
Subroutine _handle_non_202_poll: called CC=2 SCAR=6.9
37  
38 4 ▶ $resp->die_because_unexpected() if $resp->status() != 201;
Branch: 1 branch
BranchTrueFalseTotal
if $resp->status != 201 2 2 4
39  
40 return Net::ACME::Certificate->new(
41 content => $resp->content(),
42 type => $resp->header('content-type'),
43 2 issuer_cert_uri => { $resp->links() }->{'up'},
44 );
45 }
46  
47 7 1;
« ACME/X/OverloadBase.pm ↑ Summary ACME/X/HashBase.pm »