line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewFangle::Config 0.07 { |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
142
|
use strict; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
244
|
|
4
|
7
|
|
|
7
|
|
40
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
212
|
|
5
|
7
|
|
|
7
|
|
216
|
use 5.014; |
|
7
|
|
|
|
|
27
|
|
6
|
7
|
|
|
7
|
|
42
|
use NewFangle::FFI; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
537
|
|
7
|
7
|
|
|
7
|
|
60
|
use FFI::C::Util (); |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
2141
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: NewRelic Configuration class. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$ffi->attach( [ create_app_config => 'new' ] => [ 'string', 'string' ] => 'newrelic_app_config_t' => sub { |
13
|
|
|
|
|
|
|
my($xsub, $class, %config) = @_; |
14
|
|
|
|
|
|
|
my $app_name = delete $config{app_name} // $ENV{NEWRELIC_APP_NAME} // 'AppName'; |
15
|
|
|
|
|
|
|
my $license_key = delete $config{license_key} // $ENV{NEWRELIC_LICENSE_KEY} // ''; |
16
|
|
|
|
|
|
|
my $config = $xsub->($app_name, $license_key); |
17
|
|
|
|
|
|
|
FFI::C::Util::perl_to_c($config, \%config); |
18
|
|
|
|
|
|
|
bless { |
19
|
|
|
|
|
|
|
config => $config, |
20
|
|
|
|
|
|
|
}, $class; |
21
|
|
|
|
|
|
|
}); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_perl |
25
|
|
|
|
|
|
|
{ |
26
|
1
|
|
|
1
|
1
|
6430
|
my($self) = @_; |
27
|
1
|
|
|
|
|
8
|
FFI::C::Util::c_to_perl($self->{config}); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$ffi->attach( [ destroy_app_config => 'DESTROY' ] => [ 'opaque*' ] => 'bool' => sub { |
31
|
|
|
|
|
|
|
my($xsub, $self) = @_; |
32
|
|
|
|
|
|
|
my $ptr = delete $self->{config}->{ptr}; |
33
|
|
|
|
|
|
|
$xsub->(\$ptr); |
34
|
|
|
|
|
|
|
}); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |