ACME2/LetsEncrypt.pm

filter: Statementstmt 84.2% 16 / 19 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 70.9% 22 / 31 SCAR 15.1
CC
4
Cov
68%
HOST
8.7
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
« ACME2/AccessorBase.pm ↑ Summary ACME2/Challenge/http_01.pm »
1 package Net::ACME2::LetsEncrypt;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent qw( Net::ACME2 );
Subroutine BEGIN: called CC=1 SCAR=0.0
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<Net::ACME2> for usage examples.
24  
25 =head1 STAGING VS. PRODUCTION
26  
27 This class’s constructor accepts an optional C<environment> parameter.
28 If you set this to C<staging>, you’ll get
29 L<Let’s Encrypt’s staging server|https://letsencrypt.org/docs/staging-environment/>
30 rather than the (default) C<production> server.
31  
32 =cut
33  
34 use constant {
35 1 DIRECTORY_PATH => '/directory',
36  
37 _STAGING_SERVER => 'acme-staging-v02.api.letsencrypt.org',
38 _PRODUCTION_SERVER => 'acme-v02.api.letsencrypt.org',
39 1 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 sub HOST {
42 1 ▶ my ($class, %opts) = @_;
Subroutine HOST: called CC=4 SCAR=21.7
Pod undocumented
43  
44 1 ▶ if ( my $env = $opts{'environment'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $env = $opts{"environment"}) 0 1 1
45 0 ▶ if ($env eq 'staging') {
Branch: 2 branches
BranchTrueFalseTotal
if ($env eq 'staging') { } 0 0 0
elsif ($env ne 'production') { } 0 0 0
46 0 return _STAGING_SERVER();
47 }
48 elsif ($env ne 'production') {
49 0 die "Invalid “environment”! ($env)";
50 }
51 }
52  
53 1 return _PRODUCTION_SERVER();
54 }
55  
56 1 1;
« ACME2/AccessorBase.pm ↑ Summary ACME2/Challenge/http_01.pm »