UCS/Common/Fan.pm

filter: Statementstmt 60.4% 26 / 43 Branchbran 16.6% 2 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 1 totaltotal 51.5% 33 / 64 CC 6 SCAR 29.9
CC
6
Cov
51%
new
42.0
__ANON__
1.3
__ANON__
1.3
CRAP 20.0
« UCS.pm ↑ Summary UCS/Blade.pm »
1 package Cisco::UCS::Common::Fan;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '0.51';
10  
11 2 our @ATTRIBUTES = qw(dn id model operability power presence revision serial
12 thermal tray vendor voltage);
13  
14 2 our %ATTRIBUTES = (
15 performance => 'perf',
16 oper_state => 'operState'
17 );
18  
19 {
20 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 ▶ while ( my ($pseudo, $attribute) = each %ATTRIBUTES ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %Cisco::UCS::Common::Fan::ATTRIBUTES) 4 2 6
23 4 ▶ *{ __PACKAGE__ . '::' . $pseudo } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
24 0 my $self = shift;
25 0 return $self->{$attribute}
26 }
27 4 }
28
29 2 foreach my $attribute (@ATTRIBUTES) {
30 24 ▶ *{ __PACKAGE__ . '::' . $attribute } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
31 0 my $self = shift;
32 0 return $self->{$attribute}
33 }
34 24 }
35 }
36  
37 0 ▶sub new {
Subroutine new: not called CC=6 SCAR=37.4
Pod undocumented
38 0 my ( $class, %args ) = @_;
39  
40 0 my $self = {};
41 0 bless $self, $class;
42  
43 defined $args{dn}
44 ? $self->{dn} = $args{dn}
45 0 ▶ : croak 'dn not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'dn'} ? : 0 0 0
46  
47 defined $args{id}
48 ? $self->{id} = $args{id}
49 0 ▶ : croak 'id not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'id'} ? : 0 0 0
50  
51 defined $args{ucs}
52 ? weaken( $self->{ucs} = $args{ucs} )
53 0 ▶ : croak 'ucs not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'ucs'} ? : 0 0 0
54  
55 0 my %attr = %{ $self->{ucs}->resolve_dn(
56 dn => $self->{dn}
57 )
58 0 };
59  
60 0 %attr = %{ exists $attr{outConfig}{equipmentFan}
61 ? $attr{outConfig}{equipmentFan}
62 : $attr{outConfig}{equipmentFanModule}
63 0 ▶ };
Branch: 1 branch
BranchTrueFalseTotal
exists $attr{'outConfig'}{'equipmentFan'} ? : 0 0 0
64  
65 0 ▶ while ( my ($k, $v ) = each %attr) { $self->{$k} = $v }
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %attr) 0 0 0
66  
67 0 return $self;
68 }
69  
70 2 1;
71  
72 __END__
« UCS.pm ↑ Summary UCS/Blade.pm »