File Coverage

blib/lib/IBM/StorageSystem/Health.pm
Criterion Covered Total %
statement 12 22 54.5
branch 0 6 0.0
condition n/a
subroutine 4 10 40.0
pod 0 1 0.0
total 16 39 41.0


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Health;
2              
3 1     1   7 use strict;
  1         3  
  1         33  
4 1     1   6 use warnings;
  1         2  
  1         28  
5              
6 1     1   6 use Carp qw(croak);
  1         1  
  1         116  
7              
8             our $VERSION = '0.01';
9             our @ATTR = qw(Host:Sensor Host Sensor Status Value);
10              
11             foreach my $attr ( map lc, @ATTR ) {
12             {
13 1     1   90 no strict 'refs';
  1         3  
  1         246  
14             *{ __PACKAGE__ .'::'. $attr } = sub {
15 0     0     my( $self, $val ) = @_;
        0      
        0      
        0      
        0      
16 0 0         $val =~ s/\#/no/ if $val;
17 0 0         $self->{$attr} = $val if $val;
18 0           return $self->{$attr}
19             }
20             }
21             }
22              
23             sub new {
24 0     0 0   my( $class, $ibm, %args ) = @_;
25 0           my $self = bless {}, $class;
26 0 0         defined $args{'Host:Sensor'} or croak __PACKAGE__
27             . ' constructor failed: mandatory Host:Sensor argument not supplied';
28            
29 0           foreach my $attr ( @ATTR ) { $self->{lc $attr} = $args{$attr} }
  0            
30              
31 0           return $self
32             }
33              
34             1;
35              
36             __END__