File Coverage

blib/lib/IBM/StorageSystem/Quota.pm
Criterion Covered Total %
statement 12 26 46.1
branch 0 4 0.0
condition n/a
subroutine 4 13 30.7
pod 0 1 0.0
total 16 44 36.3


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Quota;
2              
3 1     1   5 use strict;
  1         2  
  1         31  
4 1     1   6 use warnings;
  1         2  
  1         23  
5              
6 1     1   5 use Carp qw(croak);
  1         1  
  1         86  
7              
8             our $VERSION = '0.02';
9             our @ATTR = qw(cluster device fileset type ID name SL_usage HL_usage used_usage
10             SL_inode HL_inode used_inode gracetime_usage gracetime_inode in_doubt_kB last_update);
11              
12             foreach my $attr ( @ATTR ) {
13             {
14 1     1   4 no strict 'refs';
  1         2  
  1         272  
15             *{ __PACKAGE__ .'::'. $attr } = sub {
16 0     0     my( $self, $val ) = @_;
        0      
        0      
        0      
        0      
        0      
        0      
        0      
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              
27 0 0         defined $args{'Cluster:Device:Type:ID'}
28             or croak 'Constructor failed: mandatory Cluster:Device:Type:ID argument not supplied';
29              
30 0           foreach my $attr ( keys %args ) {
31 0           my $mattr = lc $attr;
32 0           $mattr =~ s/(\(|\))//g;
33              
34 0           foreach my $s ( qw(id hl sl) ) {
35 0           my $u = uc $s;
36 0           $mattr =~ s/(^|_)($s)/$1$u/g
37             }
38              
39 0           $self->{$mattr} = $args{$attr}
40             }
41              
42 0           return $self;
43             }
44              
45             1;
46              
47             __END__