line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Probe::Runner; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
219990
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
5
|
2
|
|
|
2
|
|
42
|
use 5.008004; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
967
|
use Capture::Tiny qw( capture ); |
|
2
|
|
|
|
|
47461
|
|
|
2
|
|
|
|
|
130
|
|
7
|
2
|
|
|
2
|
|
898
|
use FFI::Probe::Runner::Result; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
930
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Probe runner for FFI |
10
|
|
|
|
|
|
|
our $VERSION = '2.06_01'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
2
|
|
|
2
|
1
|
6972
|
my($class, %args) = @_; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
33
|
|
|
11
|
$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
|
|
|
|
11
|
defined $args{flags} or $args{flags} = '-'; |
25
|
|
|
|
|
|
|
|
26
|
2
|
50
|
|
|
|
35
|
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
|
|
|
|
|
14
|
}, $class; |
32
|
2
|
|
|
|
|
9
|
$self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
8
|
1
|
78
|
sub exe { shift->{exe} } |
37
|
8
|
|
|
8
|
1
|
648
|
sub flags { shift->{flags} } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub verify |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
1
|
3
|
my($self) = @_; |
43
|
1
|
|
|
|
|
5
|
my $exe = $self->exe; |
44
|
|
|
|
|
|
|
my($out, $err, $ret) = capture { |
45
|
1
|
|
|
1
|
|
1349
|
$! = 0; |
46
|
1
|
|
|
|
|
3904
|
system $exe, 'verify', 'self'; |
47
|
1
|
|
|
|
|
31
|
}; |
48
|
1
|
50
|
33
|
|
|
1353
|
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
|
857
|
my($self, $dll, @args) = @_; |
58
|
7
|
|
|
|
|
79
|
my $exe = $self->exe; |
59
|
7
|
|
|
|
|
62
|
my $flags = $self->flags; |
60
|
|
|
|
|
|
|
my($out, $err, $ret) = capture { |
61
|
7
|
|
|
7
|
|
12133
|
my @cmd = ($exe, $dll, $flags, @args); |
62
|
7
|
|
|
|
|
28
|
$! = 0; |
63
|
7
|
|
|
|
|
27315
|
system @cmd; |
64
|
7
|
|
|
|
|
699
|
$?; |
65
|
7
|
|
|
|
|
1145
|
}; |
66
|
7
|
|
|
|
|
10224
|
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__ |