File Coverage

blib/lib/IBM/StorageSystem/Enclosure/Slot.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 4 0.0
condition n/a
subroutine 4 13 30.7
pod 0 1 0.0
total 16 39 41.0


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Enclosure::Slot;
2              
3 1     1   7 use strict;
  1         1  
  1         41  
4 1     1   7 use warnings;
  1         2  
  1         30  
5              
6 1     1   6 use Carp qw(croak);
  1         2  
  1         108  
7              
8             our @ATTR = qw(drive_id drive_present enclosure_id error_sequence_number fault_LED port_1_status port_2_status powered slot_id);
9              
10             foreach my $attr ( @ATTR ) {
11             {
12 1     1   6 no strict 'refs';
  1         2  
  1         236  
13             *{ __PACKAGE__ .'::'. $attr } = sub {
14 0     0     my( $self, $val ) = @_;
        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{slot_id} or croak 'Constructor failed: mandatory argument slot_id 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__