line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DNS::Hetzner; |
2
|
|
|
|
|
|
|
$DNS::Hetzner::VERSION = '0.05'; |
3
|
2
|
|
|
2
|
|
58748
|
use v5.24; |
|
2
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Perl library to work with the API for the Hetzner DNS |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
412
|
use Mojo::Base -strict, -signatures; |
|
2
|
|
|
|
|
190153
|
|
|
2
|
|
|
|
|
16
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
7702
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
10
|
2
|
|
|
2
|
|
554
|
use Moo; |
|
2
|
|
|
|
|
10281
|
|
|
2
|
|
|
|
|
11
|
|
11
|
2
|
|
|
2
|
|
2310
|
use Mojo::File; |
|
2
|
|
|
|
|
32504
|
|
|
2
|
|
|
|
|
89
|
|
12
|
2
|
|
|
2
|
|
475
|
use Mojo::Loader qw(find_modules load_class); |
|
2
|
|
|
|
|
4891
|
|
|
2
|
|
|
|
|
105
|
|
13
|
2
|
|
|
2
|
|
575
|
use Mojo::UserAgent; |
|
2
|
|
|
|
|
238372
|
|
|
2
|
|
|
|
|
21
|
|
14
|
2
|
|
|
2
|
|
86
|
use Mojo::Util qw(decamelize); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
146
|
|
15
|
2
|
|
|
2
|
|
530
|
use Types::Mojo qw(:all); |
|
2
|
|
|
|
|
146850
|
|
|
2
|
|
|
|
|
24
|
|
16
|
2
|
|
|
2
|
|
8360
|
use Types::Standard qw(Str); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
3045
|
use DNS::Hetzner::Schema; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
93
|
|
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
14
|
no warnings 'experimental::signatures'; |
|
2
|
|
|
|
|
31
|
|
|
2
|
|
|
|
|
537
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has token => ( is => 'ro', isa => Str, required => 1 ); |
23
|
|
|
|
|
|
|
has host => ( is => 'ro', isa => MojoURL["https?"], default => sub { 'https://dns.hetzner.com' }, coerce => 1 ); |
24
|
|
|
|
|
|
|
has base_uri => ( is => 'ro', isa => Str, default => sub { 'api/v1' } ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has client => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
lazy => 1, |
29
|
|
|
|
|
|
|
isa => MojoUserAgent, |
30
|
|
|
|
|
|
|
default => sub { |
31
|
|
|
|
|
|
|
Mojo::UserAgent->new, |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
|
5
|
sub _load_namespace ($package) { |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
36
|
2
|
|
|
|
|
17
|
my @modules = find_modules $package . '::API', { recursive => 1 }; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
4769
|
for my $module ( @modules ) { |
39
|
6
|
|
|
|
|
161
|
load_class( $module ); |
40
|
|
|
|
|
|
|
|
41
|
6
|
|
|
|
|
192
|
my $base = (split /::/, $module)[-1]; |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
2
|
|
13
|
no strict 'refs'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
442
|
|
44
|
6
|
|
|
2
|
|
53
|
*{ $package . '::' . decamelize( $base ) } = sub ($dns) { |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
3148
|
|
|
2
|
|
|
|
|
6
|
|
45
|
2
|
|
33
|
|
|
63
|
state $object //= $module->instance( |
46
|
|
|
|
|
|
|
token => $dns->token, |
47
|
|
|
|
|
|
|
base_uri => $dns->base_uri, |
48
|
|
|
|
|
|
|
client => $dns->client, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
795
|
return $object; |
52
|
6
|
|
|
|
|
46
|
}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__PACKAGE__->_load_namespace; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |