| line | stmt | bran | cond | sub | pod | time | code | 
| 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. | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | =cut | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 8 |  |  | 8 |  | 121442 | use strict; | 
|  | 8 |  |  |  |  | 25 |  | 
|  | 8 |  |  |  |  | 230 |  | 
| 30 | 8 |  |  | 8 |  | 40 | use warnings; | 
|  | 8 |  |  |  |  | 17 |  | 
|  | 8 |  |  |  |  | 212 |  | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 8 |  |  | 8 |  | 40 | use parent qw( Net::ACME::AccessorBase ); | 
|  | 8 |  |  |  |  | 15 |  | 
|  | 8 |  |  |  |  | 39 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 8 |  |  | 8 |  | 488 | use constant _ACCESSORS => qw( error status ); | 
|  | 8 |  |  |  |  | 25 |  | 
|  | 8 |  |  |  |  | 651 |  | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 8 |  |  | 8 |  | 4900 | use Net::ACME::Utils (); | 
|  | 8 |  |  |  |  | 56 |  | 
|  | 8 |  |  |  |  | 214 |  | 
| 37 | 8 |  |  | 8 |  | 48 | use Net::ACME::X (); | 
|  | 8 |  |  |  |  | 21 |  | 
|  | 8 |  |  |  |  | 240 |  | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | my $ERROR_CLASS; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | BEGIN { | 
| 42 | 8 |  |  | 8 |  | 1341 | $ERROR_CLASS = 'Net::ACME::Error'; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | sub new { | 
| 46 | 5 |  |  | 5 | 0 | 2274 | my ( $class, %opts ) = @_; | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 5 | 100 | 100 |  |  | 29 | if ( $opts{'error'} && !Net::ACME::Utils::thing_isa($opts{'error'}, $ERROR_CLASS) ) { | 
| 49 | 1 |  |  |  |  | 8 | die Net::ACME::X::create( 'InvalidParameter', "“error” must be an instance of “$ERROR_CLASS”, not “$opts{'error'}”!" ); | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 4 |  |  |  |  | 27 | return $class->SUPER::new( %opts ); | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | sub status { | 
| 56 | 4 |  |  | 4 | 0 | 2602 | my ($self) = @_; | 
| 57 | 4 |  | 100 |  |  | 39 | return $self->SUPER::status() || 'pending'; | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | 1; |