File Coverage

blib/lib/IBM/StorageSystem/Enclosure/PSU.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 4 0.0
condition n/a
subroutine 4 16 25.0
pod 0 1 0.0
total 16 42 38.1


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Enclosure::PSU;
2              
3 1     1   7 use strict;
  1         1  
  1         46  
4 1     1   6 use warnings;
  1         2  
  1         30  
5              
6 1     1   5 use Carp qw(croak);
  1         2  
  1         97  
7              
8             our @ATTR = qw(enclosure_id PSU_id status AC_failed DC_failed fan_failed redundant error_sequence_number FRU_part_number FRU_identity firmware_level_1 firmware_level_2);
9              
10             foreach my $attr ( @ATTR ) {
11             {
12 1     1   5 no strict 'refs';
  1         2  
  1         422  
13             *{ __PACKAGE__ .'::'. $attr } = sub {
14 0     0     my( $self, $val ) = @_;
        0      
        0      
        0      
        0      
        0      
        0      
        0      
        0      
        0      
        0      
15 0 0         $self->{$attr} = $val if $val;
16 0           return $self->{$attr}
17             }
18             }
19             }
20              
21             sub new {
22 0     0 0   my( $class, $ibm, %args ) = @_;
23 0           my $self = bless {}, $class;
24 0 0         defined $args{PSU_id} or croak 'Constructor failed: mandatory id argument not supplied';
25              
26 0           foreach my $attr ( @ATTR ) { $self->{$attr} = $args{$attr} }
  0            
27              
28 0           return $self
29             }
30              
31             1;
32              
33             __END__