UCS/Fault.pm

filter: Statementstmt 65.0% 26 / 40 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 1 totaltotal 57.8% 33 / 57 CC 4 SCAR 20.7
CC
4
Cov
58%
new
20.0
__ANON__
1.3
__ANON__
1.3
CRAP 8.0
« UCS/FEX.pm ↑ Summary UCS/MgmtEntity.pm »
1 package Cisco::UCS::Fault;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '0.51';
10  
11 2 our @ATTRIBUTES = qw(ack code cause created dn id occur rule severity tags
12 type);
13  
14 2 our %ATTRIBUTES = (
15 last_transition => 'lastTransition',
16 highest_severity => 'highestSeverity',
17 original_severity => 'origSeverity',
18 previous_severity => 'prevSeverity',
19 desc => 'descr'
20 );
21  
22 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod undocumented
23 0 my ( $class, %args ) = @_;
24  
25 0 my $self = {};
26 0 bless $self, $class;
27  
28 defined $args{dn}
29 ? $self->{dn} = $args{dn}
30 0 ▶ : croak 'dn not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'dn'} ? : 0 0 0
31  
32 defined $args{ucs}
33 ? weaken($self->{ucs} = $args{ucs})
34 0 ▶ : croak 'ucs not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'ucs'} ? : 0 0 0
35  
36 0 my %attr = %{ $self->{ucs}->resolve_dn(
37 dn => $self->{dn}
38 0 )->{outConfig}->{faultInst}};
39  
40 0 ▶ while ( my ($k, $v) = each %attr ) { $self->{$k} = $v }
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %attr) 0 0 0
41  
42 0 return $self
43 }
44  
45 {
46 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 2 ▶ while ( my ( $pseudo, $attribute ) = each %ATTRIBUTES ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %Cisco::UCS::Fault::ATTRIBUTES) 10 2 12
49 10 ▶ *{ __PACKAGE__ . '::' . $pseudo } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
50 0 my $self = shift;
51 0 return $self->{$attribute}
52 }
53 10 }
54  
55 2 foreach my $attribute ( @ATTRIBUTES ) {
56 22 ▶ *{ __PACKAGE__ . '::' . $attribute } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
57 0 my $self = shift;
58 0 return $self->{$attribute}
59 }
60 22 }
61 }
62  
63 2 1;
64  
65 __END__
« UCS/FEX.pm ↑ Summary UCS/MgmtEntity.pm »