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