line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ACME2::LetsEncrypt; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
68325
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
370
|
use parent qw( Net::ACME2 ); |
|
1
|
|
|
|
|
263
|
|
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=encoding utf-8 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::ACME2::LetsEncrypt - Let’s Encrypt’s v2 API endpoint |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $acme = Net::ACME2::LetsEncrypt->new( |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
environment => 'staging', #default: “production” |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# ... and other arg(s) as described in Net::ACME2 |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
See L for usage examples. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 STAGING VS. PRODUCTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This class’s constructor accepts an optional C parameter. |
28
|
|
|
|
|
|
|
If you set this to C, you’ll get |
29
|
|
|
|
|
|
|
L |
30
|
|
|
|
|
|
|
rather than the (default) C server. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use constant { |
35
|
1
|
|
|
|
|
129
|
DIRECTORY_PATH => '/directory', |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
_STAGING_SERVER => 'acme-staging-v02.api.letsencrypt.org', |
38
|
|
|
|
|
|
|
_PRODUCTION_SERVER => 'acme-v02.api.letsencrypt.org', |
39
|
1
|
|
|
1
|
|
60
|
}; |
|
1
|
|
|
|
|
2
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub HOST { |
42
|
1
|
|
|
1
|
0
|
3
|
my ($class, %opts) = @_; |
43
|
|
|
|
|
|
|
|
44
|
1
|
50
|
|
|
|
4
|
if ( my $env = $opts{'environment'} ) { |
45
|
0
|
0
|
|
|
|
0
|
if ($env eq 'staging') { |
|
|
0
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
return _STAGING_SERVER(); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
elsif ($env ne 'production') { |
49
|
0
|
|
|
|
|
0
|
die "Invalid “environment”! ($env)"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
6
|
return _PRODUCTION_SERVER(); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |