File Coverage

blib/lib/IBM/StorageSystem/Interface.pm
Criterion Covered Total %
statement 12 28 42.8
branch 0 6 0.0
condition n/a
subroutine 4 6 66.6
pod 0 1 0.0
total 16 41 39.0


line stmt bran cond sub pod time code
1             package IBM::StorageSystem::Interface;
2              
3 1     1   5 use strict;
  1         2  
  1         30  
4 1     1   5 use warnings;
  1         3  
  1         24  
5              
6 1     1   5 use Carp qw(croak);
  1         1  
  1         184  
7              
8             our $VERSION = '0.02';
9             our @ATTR = qw(Node:Interface Node Interface MAC Master/Subordinate Bonding_mode
10             Transmit_hash_policy Up/Down Speed IP-Addresses MTU);
11              
12             foreach my $attr ( @ATTR ) {
13             {
14             my $mattr = lc $attr;
15             $mattr =~ s/\//_or_/g;
16             $mattr =~ s/-/_/g;
17              
18             foreach my $s ( qw(ip mac mtu) ) {
19             my $u = uc $s;
20             $mattr =~ s/(^|_)($s)/$1$u/g
21             }
22              
23 1     1   6 no strict 'refs';
  1         2  
  1         301  
24             *{ __PACKAGE__ .'::'. $mattr } = sub {
25 0     0     my( $self, $val ) = @_;
26 0 0         $val =~ s/\#/no/ if $val;
27 0 0         $self->{$mattr} = $val if $val;
28 0           return $self->{$mattr}
29             }
30             }
31             }
32              
33             sub new {
34 0     0 0   my( $class, $ibm, %args ) = @_;
35 0           my $self = bless {}, $class;
36              
37 0 0         defined $args{'Node:Interface'}
38             or croak __PACKAGE__ . ' Constructor failed: mandatory Node:Interface argument not supplied';
39              
40 0           foreach my $attr ( keys %args ) {
41 0           my $mattr = lc $attr;
42 0           $mattr =~ s/\//_or_/g;
43 0           $mattr =~ s/-/_/g;
44              
45 0           foreach my $s ( qw(ip mac mtu) ) {
46 0           my $u = uc $s;
47 0           $mattr =~ s/(^|_)($s)/$1$u/g
48             }
49              
50 0           $self->{$mattr} = $args{$attr}
51             }
52              
53 0           return $self;
54             }
55              
56             1;
57              
58             __END__