line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Probe::Runner; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
232658
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
5
|
2
|
|
|
2
|
|
36
|
use 5.008004; |
|
2
|
|
|
|
|
7
|
|
6
|
2
|
|
|
2
|
|
1080
|
use Capture::Tiny qw( capture ); |
|
2
|
|
|
|
|
50308
|
|
|
2
|
|
|
|
|
119
|
|
7
|
2
|
|
|
2
|
|
897
|
use FFI::Probe::Runner::Result; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
950
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Probe runner for FFI |
10
|
|
|
|
|
|
|
our $VERSION = '2.08'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
2
|
|
|
2
|
1
|
7396
|
my($class, %args) = @_; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
33
|
|
|
12
|
$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
|
|
|
|
13
|
defined $args{flags} or $args{flags} = '-'; |
25
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
44
|
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
|
|
|
|
|
18
|
}, $class; |
32
|
2
|
|
|
|
|
10
|
$self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
8
|
1
|
60
|
sub exe { shift->{exe} } |
37
|
8
|
|
|
8
|
1
|
606
|
sub flags { shift->{flags} } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub verify |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
1
|
4
|
my($self) = @_; |
43
|
1
|
|
|
|
|
5
|
my $exe = $self->exe; |
44
|
|
|
|
|
|
|
my($out, $err, $ret) = capture { |
45
|
1
|
|
|
1
|
|
1400
|
$! = 0; |
46
|
1
|
|
|
|
|
3354
|
system $exe, 'verify', 'self'; |
47
|
1
|
|
|
|
|
37
|
}; |
48
|
1
|
50
|
33
|
|
|
1328
|
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
|
847
|
my($self, $dll, @args) = @_; |
58
|
7
|
|
|
|
|
52
|
my $exe = $self->exe; |
59
|
7
|
|
|
|
|
85
|
my $flags = $self->flags; |
60
|
|
|
|
|
|
|
my($out, $err, $ret) = capture { |
61
|
7
|
|
|
7
|
|
11258
|
my @cmd = ($exe, $dll, $flags, @args); |
62
|
7
|
|
|
|
|
23
|
$! = 0; |
63
|
7
|
|
|
|
|
33399
|
system @cmd; |
64
|
7
|
|
|
|
|
655
|
$?; |
65
|
7
|
|
|
|
|
918
|
}; |
66
|
7
|
|
|
|
|
9925
|
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__ |