| 1 | package GRID::Cluster::Result; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use GRID::Machine::MakeAccessors; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use GRID::Machine::Message; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use GRID::Machine::Result; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use overload q("") => 'str', | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | bool => 'allfirstok'; | |||||||||
| 8 | |||||||||||
| 9 | # Constructor | ||||||||||
| 10 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 11 | |||||||||||
| 12 | 0 | my $class = shift; | |||||||||
| 13 | |||||||||||
| 14 | 0 | my $self = {}; | |||||||||
| 15 | |||||||||||
| 16 | 0 | bless $self, $class; | |||||||||
| 17 | 0 | return $self; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | # Adds a new GRID::Machine::Result object to a GRID::Cluster::Result object | ||||||||||
| 21 | 0 | ▶ | sub add { | ||||||||
|
Subroutine
add: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 22 | |||||||||||
| 23 | 0 | my $self = shift; | |||||||||
| 24 | 0 | my %args = @_; | |||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | my $host_name = $args{host_name} if defined($args{host_name}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | my $machine_result = $args{machine_result} if defined($args{machine_result}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 0 | $self->{$host_name} = $machine_result; | |||||||||
| 30 | |||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | # Methods | ||||||||||
| 34 | |||||||||||
| 35 | # This method returns a reference to a list of trues or falses, | ||||||||||
| 36 | # depending on there were / weren't errors during executions | ||||||||||
| 37 | 0 | ▶ | sub result { | ||||||||
|
Subroutine
result: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 38 | 0 | my $self = shift; | |||||||||
| 39 | |||||||||||
| 40 | 0 | return [ map { $self->{$_}->result } keys %{$self} ]; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | # This method returns true if all the values of the list returned by | ||||||||||
| 44 | # the method "results" are true. | ||||||||||
| 45 | # This method is used for overloading the bool operator | ||||||||||
| 46 | 0 | ▶ | sub allfirstok { | ||||||||
|
Subroutine
allfirstok: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 47 | 0 | my $self = shift; | |||||||||
| 48 | |||||||||||
| 49 | 0 | my @results = @{$self->result}; | |||||||||
| 50 | |||||||||||
| 51 | 0 | my @falses = grep { !$_ } @results; | |||||||||
| 52 | |||||||||||
| 53 | 0 | return !@falses; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | # This method is used for overloading the q("") operator | ||||||||||
| 57 | 0 | ▶ | sub str { | ||||||||
|
Subroutine
str: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 58 | 0 | my $self = shift; | |||||||||
| 59 | |||||||||||
| 60 | 0 | my $string = ""; | |||||||||
| 61 | 0 | my @host_names = keys %{$self}; | |||||||||
| 62 | |||||||||||
| 63 | 0 | foreach (@host_names) { | |||||||||
| 64 | 0 | $string .= "$_: ".$self->{$_}->str."\n"; | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 0 | return $string; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | 1 | 1; | |||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||