line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Probe::Runner; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
183454
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
52
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
38
|
|
5
|
2
|
|
|
2
|
|
31
|
use 5.008004; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
830
|
use Capture::Tiny qw( capture ); |
|
2
|
|
|
|
|
38692
|
|
|
2
|
|
|
|
|
104
|
|
7
|
2
|
|
|
2
|
|
742
|
use FFI::Probe::Runner::Result; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
791
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Probe runner for FFI |
10
|
|
|
|
|
|
|
our $VERSION = '2.07'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
2
|
|
|
2
|
1
|
5896
|
my($class, %args) = @_; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
33
|
|
|
9
|
$args{exe} ||= do { |
18
|
0
|
|
|
|
|
0
|
require FFI::Platypus::ShareConfig; |
19
|
0
|
|
|
|
|
0
|
require File::Spec; |
20
|
0
|
|
|
|
|
0
|
require Config; |
21
|
0
|
|
|
|
|
0
|
File::Spec->catfile(FFI::Platypus::ShareConfig::dist_dir('FFI::Platypus'), 'probe', 'bin', "dlrun$Config::Config{exe_ext}"); |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
2
|
50
|
|
|
|
12
|
defined $args{flags} or $args{flags} = '-'; |
25
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
28
|
die "probe runner executable not found at: $args{exe}" unless -f $args{exe}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $self = bless { |
29
|
|
|
|
|
|
|
exe => $args{exe}, |
30
|
|
|
|
|
|
|
flags => $args{flags}, |
31
|
2
|
|
|
|
|
11
|
}, $class; |
32
|
2
|
|
|
|
|
10
|
$self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
8
|
1
|
47
|
sub exe { shift->{exe} } |
37
|
8
|
|
|
8
|
1
|
472
|
sub flags { shift->{flags} } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub verify |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
1
|
3
|
my($self) = @_; |
43
|
1
|
|
|
|
|
3
|
my $exe = $self->exe; |
44
|
|
|
|
|
|
|
my($out, $err, $ret) = capture { |
45
|
1
|
|
|
1
|
|
1224
|
$! = 0; |
46
|
1
|
|
|
|
|
3448
|
system $exe, 'verify', 'self'; |
47
|
1
|
|
|
|
|
45
|
}; |
48
|
1
|
50
|
33
|
|
|
1394
|
return 1 if $ret == 0 && $out =~ /dlrun verify self ok/; |
49
|
0
|
|
|
|
|
0
|
print $out; |
50
|
0
|
|
|
|
|
0
|
print STDERR $err; |
51
|
0
|
|
|
|
|
0
|
die "verify failed"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub run |
56
|
|
|
|
|
|
|
{ |
57
|
7
|
|
|
7
|
1
|
711
|
my($self, $dll, @args) = @_; |
58
|
7
|
|
|
|
|
37
|
my $exe = $self->exe; |
59
|
7
|
|
|
|
|
37
|
my $flags = $self->flags; |
60
|
|
|
|
|
|
|
my($out, $err, $ret) = capture { |
61
|
7
|
|
|
7
|
|
8807
|
my @cmd = ($exe, $dll, $flags, @args); |
62
|
7
|
|
|
|
|
22
|
$! = 0; |
63
|
7
|
|
|
|
|
23086
|
system @cmd; |
64
|
7
|
|
|
|
|
477
|
$?; |
65
|
7
|
|
|
|
|
628
|
}; |
66
|
7
|
|
|
|
|
7786
|
FFI::Probe::Runner::Result->new( |
67
|
|
|
|
|
|
|
stdout => $out, |
68
|
|
|
|
|
|
|
stderr => $err, |
69
|
|
|
|
|
|
|
rv => $ret >> 8, |
70
|
|
|
|
|
|
|
signal => $ret & 127, |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |