line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ACME2::LetsEncrypt; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
73220
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
426
|
use parent qw( Net::ACME2 ); |
|
1
|
|
|
|
|
285
|
|
|
1
|
|
|
|
|
6
|
|
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
|
|
|
|
|
150
|
DIRECTORY_PATH => '/directory', |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
_STAGING_SERVER => 'acme-staging-v02.api.letsencrypt.org', |
38
|
|
|
|
|
|
|
_PRODUCTION_SERVER => 'acme-v02.api.letsencrypt.org', |
39
|
1
|
|
|
1
|
|
78
|
}; |
|
1
|
|
|
|
|
2
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub HOST { |
42
|
1
|
|
|
1
|
0
|
5
|
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
|
|
|
|
|
9
|
return _PRODUCTION_SERVER(); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |