NetApp/Snapshot/Delta.pm

filter: Statementstmt 78.8% 41 / 52 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 5 / 15 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 75.0% 6 / 8 Podpod 50.0% 1 / 2 totaltotal 64.3% 56 / 87 CC 8 SCAR 18.0
CC
8
Cov
69%
_parse_snap_delta
10.2
BUILD
2.0
is_summary
2.0
CRAP 6.0
« NetApp/Qtree.pm ↑ Summary NetApp/Filer/TimeoutCache.pm »
1  
2 package NetApp::Snapshot::Delta;
3  
4 1 our $VERSION = '500.002';
5 1 $VERSION = eval $VERSION; ## no critic: StringyEval
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Class::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Params::Validate qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 {
15  
16 1 my %from_of :ATTR( get => 'from' );
17 1 my %to_of :ATTR( get => 'to' );
18 1 my %changed_of :ATTR( get => 'changed' );
19 1 my %time_of :ATTR( get => 'time' );
20 1 my %rate_of :ATTR( get => 'rate' );
21 1 my %summary_of :ATTR( get => 'summary' );
22  
23 0 ▶ sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
24  
25 0 my ($self,$ident,$args_ref) = @_;
26  
27 0 my @args = %$args_ref;
28  
29 0 my (%args) = validate( @args, {
30 from => { type => SCALAR },
31 to => { type => SCALAR },
32 changed => { type => SCALAR },
33 time => { type => SCALAR },
34 rate => { type => SCALAR },
35 summary => { type => SCALAR },
36 });
37  
38 0 $from_of{$ident} = $args{from};
39 0 $to_of{$ident} = $args{to};
40 0 $changed_of{$ident} = $args{changed};
41 0 $time_of{$ident} = $args{time};
42 0 $rate_of{$ident} = $args{rate};
43 0 $summary_of{$ident} = $args{summary};
44  
45 }
46  
47 0 ▶ sub is_summary {
Subroutine is_summary: not called CC=1 SCAR=6.9
Pod documented
48 0 return shift->get_summary;
49 }
50  
51 }
52  
53 1 ▶sub _parse_snap_delta {
Subroutine _parse_snap_delta: called CC=8 SCAR=23.2
54  
55 3 my $class = shift;
56 3 my $line = shift;
57  
58 3 $line =~ s/Active File System/active/g;
59  
60 3 my @line = split /\s+/, $line;
61  
62 3 my $from = shift @line;
63 3 my $to = shift @line;
64 3 my $changed = shift @line;
65 3 my $time = shift @line;
66 3 my $next = shift @line;
67 3 my $rate;
68  
69 3 ▶ if ( $next =~ /^\d{2}:\d{2}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next =~ /^\d{2}:\d{2}$/) { } 2 1 3
70 2 $time .= " $next";
71 2 $rate = shift @line;
72 } else {
73 1 $rate = $next;
74 }
75  
76 3 ▶ if ( @line || ! defined $from || ! defined $to ||
Branch: 1 branch
BranchTrueFalseTotal
if (@line or not defined $from or not defined $to or not defined $changed or not defined $time or not defined $rate) 0 3 3
Condition33%5/15
@line or not defined $from or not defined $to or not defined $changed or not defined $time or not defined $rate
l!l&&r!l&&!r
003
@line or not defined $from or not defined $to or not defined $changed or not defined $time
l!l&&r!l&&!r
003
@line or not defined $from or not defined $to or not defined $changed
l!l&&r!l&&!r
003
@line or not defined $from or not defined $to
l!l&&r!l&&!r
003
@line or not defined $from
l!l&&r!l&&!r
003
MC/DC0%0/6
@line or not defined $from or not defined $to or not defined $changed or not defined $time or not defined $rate
@line not defined $from not defined $to not defined $changed not defined $time not defined $rate
Truth table14%1/7
A or not(B) or not(C) or not(D) or not(E) or not(F)
A= @lineB= not defined $fromC= not defined $toD= not defined $changedE= not defined $timeF= not defined $rate
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
77 ! defined $changed || ! defined $time || ! defined $rate ) {
78 0 croak("Unable to parse snapshot delta: $line\n");
79 }
80  
81 return {
82 3 from => $from,
83 to => $to,
84 changed => $changed,
85 time => $time,
86 rate => $rate,
87 };
88  
89 }
90  
91 1 1;
« NetApp/Qtree.pm ↑ Summary NetApp/Filer/TimeoutCache.pm »