| line | stmt | bran | cond | sub | pod | time | code | 
| 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 |  |  | 7 |  | 49 | use strict; | 
|  | 7 |  |  |  |  | 14 |  | 
|  | 7 |  |  |  |  | 201 |  | 
| 29 | 7 |  |  | 7 |  | 33 | use warnings; | 
|  | 7 |  |  |  |  | 15 |  | 
|  | 7 |  |  |  |  | 184 |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 7 |  |  | 7 |  | 33 | use parent qw( Net::ACME::RetryAfter ); | 
|  | 7 |  |  |  |  | 11 |  | 
|  | 7 |  |  |  |  | 37 |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 7 |  |  | 7 |  | 375 | use Net::ACME::Certificate (); | 
|  | 7 |  |  |  |  | 13 |  | 
|  | 7 |  |  |  |  | 829 |  | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | sub _handle_non_202_poll { | 
| 36 | 4 |  |  | 4 |  | 10 | my ( $self, $resp ) = @_; | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 4 | 100 |  |  |  | 152 | $resp->die_because_unexpected() if $resp->status() != 201; | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | return Net::ACME::Certificate->new( | 
| 41 |  |  |  |  |  |  | content         => $resp->content(), | 
| 42 |  |  |  |  |  |  | type            => $resp->header('content-type'), | 
| 43 | 2 |  |  |  |  | 57 | issuer_cert_uri => { $resp->links() }->{'up'}, | 
| 44 |  |  |  |  |  |  | ); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | 1; |