line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GRID::Machine::Result; |
2
|
20
|
|
|
20
|
|
126
|
use List::Util qw(first); |
|
20
|
|
|
|
|
49
|
|
|
20
|
|
|
|
|
1817
|
|
3
|
20
|
|
|
|
|
206
|
use overload q("") => 'str', |
4
|
20
|
|
|
20
|
|
126
|
'0+' => 'bool'; |
|
20
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my @legal = qw(type stdout stderr results errcode errmsg); |
7
|
|
|
|
|
|
|
my %legal = map { $_ => 1 } @legal; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
{ # Compatibility with the past: aliases |
10
|
20
|
|
|
20
|
|
2399
|
no warnings; |
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
14474
|
|
11
|
|
|
|
|
|
|
*rstdout = \&stdout; |
12
|
|
|
|
|
|
|
*rstderr = \&stderr; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
0
|
|
0
|
0
|
1
|
|
my $class = shift || die "Error: Provide a class\n"; |
17
|
0
|
|
|
|
|
|
my %args = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $a = ""; |
20
|
0
|
0
|
|
0
|
|
|
die "Illegal arg $a\n" if $a = first { !exists $legal{$_} } keys(%args); |
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
$args{stderr} = '' unless $args{stderr}; |
23
|
0
|
0
|
|
|
|
|
$args{stdout} = '' unless $args{stdout}; |
24
|
0
|
0
|
|
|
|
|
$args{errcode} = 0 unless $args{errcode}; |
25
|
0
|
0
|
|
|
|
|
$args{errmsg} = '' unless $args{errmsg}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
bless \%args, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub ok { |
31
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return $self->{type} ne 'DIED'; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub noerr { |
37
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
0
|
|
|
|
return (($self->{type} ne 'DIED') and ($self->{stderr} eq '')); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub bool { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
0+$self->Results > 1 ? scalar($self->Results) : $self->result; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub result { |
49
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return $self->{results}[0]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub Results { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return @{$self->{results}}; |
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub str { |
61
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return $self->{stdout}.$self->{stderr}.$self->{errmsg} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
GRID::Machine::MakeAccessors::make_accessors(@legal); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |