StorageSystem/EnclosureBattery.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 37 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package IBM::StorageSystem::EnclosureBattery;
2  
3 use strict;
4 use warnings;
5  
6 use Carp qw(croak);
7  
8 our @ATTR = qw(enclosure_id:battery_id enclosure_id battery_id status charging_status recondition_needed percent_charged end_of_life_warning);
9  
10 foreach my $attr ( @ATTR ) {
11 {
12 no strict 'refs';
13 *{ __PACKAGE__ .'::'. $attr } = sub {
14 my( $self, $val ) = @_;
15 $self->{$attr} = $val if $val;
16 return $self->{$attr}
17 }
18 }
19 }
20  
21 sub new {
22 my( $class, %args ) = @_;
23 my $self = bless {}, $class;
24 defined $args{'enclosure_id:battery_id'} or croak __PACKAGE__ . ' constructor failed: mandatory enclosure_id:battery_id argument not supplied';
25  
26 foreach my $attr ( @ATTR ) { $self->{$attr} = $args{$attr} }
27  
28 return $self
29 }
30  
31 1;
32