File Coverage

blib/lib/IBM/StorageSystem/Pool.pm
Criterion Covered Total %
statement 15 29 51.7
branch 0 4 0.0
condition 0 2 0.0
subroutine 5 15 33.3
pod 0 1 0.0
total 20 51 39.2


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Pool;
2              
3 1     1   5 use strict;
  1         1  
  1         25  
4 1     1   4 use warnings;
  1         1  
  1         21  
5              
6 1     1   5 use Carp qw(croak);
  1         2  
  1         77  
7              
8             our $VERSION = '0.01';
9             our @ATTR = qw(Filesystem:Name Filesystem Name Size Usage Available_fragments Available_blocks Disk_list);
10              
11             foreach my $attr ( map lc, @ATTR ) {
12             {
13 1     1   4 no strict 'refs';
  1         2  
  1         130  
14             *{ __PACKAGE__ .'::'. $attr } = sub {
15 0     0     my( $self, $val ) = @_;
        0      
        0      
        0      
        0      
        0      
        0      
        0      
16 0 0         $self->{$attr} = $val if $val;
17 0           return $self->{$attr}
18             }
19             }
20             }
21              
22             our $STATS = {
23             throughput => {
24             cmd => '-g pool_throughput',
25             class => 'IBM::StorageSystem::Statistic::Pool::Throughput'
26             },
27             };
28              
29             foreach my $stat ( keys %{ $STATS } ) {
30             {
31 1     1   4 no strict 'refs';
  1         2  
  1         236  
32             *{ __PACKAGE__ .'::'. $stat } =
33             sub {
34 0     0     my( $self, $t ) = @_;
35 0   0       $t ||= 'minute';
36 0           my $stats = $self->{__ibm}->__lsperfdata( cmd => "$STATS->{$stat}->{cmd} -t $t -p $self->{'filesystem:name'}",
37             class => $STATS->{$stat}->{class}
38             );
39 0           return $stats
40             }
41             }
42             }
43              
44             sub new {
45 0     0 0   my( $class, $ibm, %args ) = @_;
46 0           my $self = bless {}, $class;
47 0 0         defined lc $args{'filesystem:pool'} or croak __PACKAGE__ . ' constructor failed: mandatory filesystem:pool argument not supplied';
48 0           $self->{ name } = $args{Name};
49              
50 0           foreach my $attr ( keys %args ) { $self->{lc $attr} = $args{$attr} }
  0            
51              
52 0           return $self
53             }
54              
55             1;
56              
57             __END__