NetApp/Filer/Export.pm

filter: Statementstmt 18.8% 50 / 265 Branchbran 9.7% 9 / 92 Conditioncond 16.6% 7 / 42 MC/DCmcdc 15.3% 4 / 26 Subroutinesub 19.3% 6 / 31 Podpod 96.0% 24 / 25 totaltotal 20.7% 100 / 481 CC 62 SCAR 48.8
CC
62
Cov
17%
compare
420.0
update
156.0
BUILD
132.0
CRAP 131.0
↑ Summary NetApp/Filer.pm »
1  
2 package NetApp::Filer::Export;
3  
4 7 our $VERSION = '500.002';
5 7 $VERSION = eval $VERSION; ## no critic: StringyEval
6  
7 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 ▶use Class::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 7 ▶use Params::Validate qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 {
15  
16 7 my %filer_of :ATTR( get => 'filer' );
17  
18 7 my %type_of :ATTR( get => 'type' );
19 7 my %active_of :ATTR( get => 'active', set => 'active' );
20  
21 7 my %path_of :ATTR( get => 'path' );
22 7 my %actual_of :ATTR( get => 'actual' );
23  
24 7 my %nosuid_of :ATTR( get => 'nosuid', set => 'nosuid' );
25 7 my %anon_of :ATTR( get => 'anon', set => 'anon' );
26  
27 7 my %sec_of :ATTR;
28 7 my %root_of :ATTR;
29  
30 7 my %rw_all_of :ATTR( get => 'rw_all' );
31 7 my %ro_all_of :ATTR( get => 'ro_all' );
32 7 my %rw_of :ATTR;
33 7 my %ro_of :ATTR;
34  
35 0 ▶ sub BUILD {
Subroutine BUILD: not called CC=11 SCAR=48.8
Pod undocumented
36  
37 0 my ($self,$ident,$args_ref) = @_;
38  
39 0 my @args = %$args_ref;
40  
41 0 my (%args) = validate( @args, {
42 filer => { isa => 'NetApp::Filer' },
43 type => { type => SCALAR,
44 default => 'permanent',
45 regex => qr{^(permanent|temporary)$},
46 optional => 1 },
47 active => { type => SCALAR,
48 default => 1,
49 optional => 1 },
50 path => { type => SCALAR },
51 actual => { type => SCALAR,
52 default => "",
53 optional => 1 },
54 nosuid => { type => SCALAR,
55 default => 0,
56 optional => 1 },
57 anon => { type => SCALAR | UNDEF,
58 default => undef,
59 optional => 1 },
60 sec => { type => ARRAYREF,
61 default => [qw(sys)],
62 optional => 1 },
63 root => { type => ARRAYREF,
64 default => [],
65 optional => 1 },
66 rw_all => { type => SCALAR,
67 optional => 1 },
68 rw => { type => ARRAYREF,
69 default => [],
70 optional => 1 },
71 ro_all => { type => SCALAR,
72 optional => 1 },
73 ro => { type => ARRAYREF,
74 default => [],
75 optional => 1 },
76 });
77  
78 0 ▶ if ( exists $args{rw_all} && @{ $args{rw} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"rw_all"} and @{$args{"rw"};}) 0 0 0
Condition0%0/3
exists $args{"rw_all"} and @{$args{"rw"};}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $args{"rw_all"} and @{$args{"rw"};}
exists $args{"rw_all"} @{$args{"rw"};}
Truth table0%0/3
A and B
A= exists $args{"rw_all"}B= @{$args{"rw"};}
ABresult
0X0
100
111
79 0 croak("Mutually exclusive arguments: rw_all and rw\n");
80 }
81  
82 0 ▶ if ( exists $args{ro_all} && @{ $args{ro} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"ro_all"} and @{$args{"ro"};}) 0 0 0
Condition0%0/3
exists $args{"ro_all"} and @{$args{"ro"};}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $args{"ro_all"} and @{$args{"ro"};}
exists $args{"ro_all"} @{$args{"ro"};}
Truth table0%0/3
A and B
A= exists $args{"ro_all"}B= @{$args{"ro"};}
ABresult
0X0
100
111
83 0 croak("Mutually exclusive arguments: ro_all and ro\n");
84 }
85  
86 0 ▶ if ( ! @{ $args{rw} } && ! exists $args{rw_all} &&
Branch: 1 branch
BranchTrueFalseTotal
unless (@{$args{"rw"};} or exists $args{"rw_all"} or @{$args{"ro"};} or exists $args{"ro_all"}) 0 0 0
Condition0%0/9
@{$args{"rw"};} or exists $args{"rw_all"} or @{$args{"ro"};} or exists $args{"ro_all"}
l!l&&r!l&&!r
000
@{$args{"rw"};} or exists $args{"rw_all"} or @{$args{"ro"};}
l!l&&r!l&&!r
000
@{$args{"rw"};} or exists $args{"rw_all"}
l!l&&r!l&&!r
000
MC/DC0%0/4
@{$args{"rw"};} or exists $args{"rw_all"} or @{$args{"ro"};} or exists $args{"ro_all"}
@{$args{"rw"};} exists $args{"rw_all"} @{$args{"ro"};} exists $args{"ro_all"}
Truth table0%0/5
A or B or C or D
A= @{$args{"rw"};}B= exists $args{"rw_all"}C= @{$args{"ro"};}D= exists $args{"ro_all"}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
87 0 ! @{ $args{ro} } && ! exists $args{ro_all} ) {
88 0 $args{rw_all} = 1;
89 }
90  
91 0 $filer_of{$ident} = $args{filer};
92 0 $path_of{$ident} = $args{path};
93 0 $type_of{$ident} = $args{type};
94 0 $active_of{$ident} = $args{active};
95 0 $actual_of{$ident} = $args{actual};
96 0 $nosuid_of{$ident} = $args{nosuid};
97 0 $anon_of{$ident} = $args{anon};
98 0 $sec_of{$ident} = $args{sec};
99 0 $root_of{$ident} = $args{root};
100  
101 0 ▶ if ( $args{rw_all} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'rw_all'}) { } 0 0 0
102 0 $rw_all_of{$ident} = $args{rw_all};
103 0 $rw_of{$ident} = [];
104 } else {
105 0 $rw_of{$ident} = $args{rw};
106 }
107  
108 0 ▶ if ( $args{ro_all} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'ro_all'}) { } 0 0 0
109 0 $ro_all_of{$ident} = $args{ro_all};
110 0 $ro_of{$ident} = [];
111 } else {
112 0 $ro_of{$ident} = $args{ro};
113 }
114  
115 }
116  
117 0 ▶ sub get_rw {
Subroutine get_rw: not called CC=1 SCAR=6.9
Pod documented
118 0 my $self = shift;
119 0 my $ident = ident $self;
120 0 return @{ $rw_of{$ident} };
121 }
122  
123 0 ▶ sub set_rw_all {
Subroutine set_rw_all: not called CC=1 SCAR=6.9
Pod documented
124 0 my $self = shift;
125 0 my $ident = ident $self;
126 0 my ($rw_all) = validate_pos( @_, { type => BOOLEAN } );
127 0 $rw_of{$ident} = [];
128 0 $rw_all_of{$ident} = $rw_all;
129 }
130  
131 0 ▶ sub set_rw {
Subroutine set_rw: not called CC=1 SCAR=6.9
Pod documented
132 0 my $self = shift;
133 0 my $ident = ident $self;
134 0 my ($rw) = validate_pos( @_, { type => ARRAYREF } );
135 0 $self->set_rw_all(0);
136 0 $rw_of{$ident} = $rw;
137 }
138  
139 0 ▶ sub has_rw {
Subroutine has_rw: not called CC=1 SCAR=6.9
Pod documented
140 0 my $self = shift;
141 0 my $ident = ident $self;
142 0 my ($rw) = validate_pos( @_, { type => SCALAR } );
143 0 return grep { $_ eq $rw } @{ $rw_of{$ident} };
144 }
145  
146 0 ▶ sub add_rw {
Subroutine add_rw: not called CC=3 SCAR=24.8
Pod documented
147 0 my $self = shift;
148 0 my $ident = ident $self;
149 0 my ($rw) = validate_pos( @_, { type => SCALAR } );
150 0 ▶ if ( $self->get_rw_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_rw_all) { } 0 0 0
151 0 return;
152 } else {
153 0 ▶ if ( not $self->has_rw( $rw ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->has_rw($rw)) 0 0 0
154 0 push @{ $rw_of{$ident} }, $rw;
155 }
156 }
157 0 return 1;
158 }
159  
160 0 ▶ sub remove_rw {
Subroutine remove_rw: not called CC=3 SCAR=24.8
Pod documented
161 0 my $self = shift;
162 0 my $ident = ident $self;
163 0 my ($rw) = validate_pos( @_, { type => SCALAR } );
164 0 ▶ if ( $self->get_rw_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_rw_all) { } 0 0 0
165 0 return;
166 } else {
167 0 ▶ if ( $self->has_rw( $rw ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_rw($rw)) 0 0 0
168 0 $rw_of{$ident} = [ grep { $_ ne $rw } @{ $rw_of{$ident} } ];
169 }
170 }
171 0 return 1;
172 }
173  
174 0 ▶ sub get_ro {
Subroutine get_ro: not called CC=1 SCAR=6.9
Pod documented
175 0 my $self = shift;
176 0 my $ident = ident $self;
177 0 return @{ $ro_of{$ident} };
178 }
179  
180 0 ▶ sub set_ro_all {
Subroutine set_ro_all: not called CC=1 SCAR=6.9
Pod documented
181 0 my $self = shift;
182 0 my $ident = ident $self;
183 0 my ($ro_all) = validate_pos( @_, { type => BOOLEAN } );
184 0 $ro_of{$ident} = [];
185 0 $ro_all_of{$ident} = $ro_all;
186 }
187  
188 0 ▶ sub set_ro {
Subroutine set_ro: not called CC=1 SCAR=6.9
Pod documented
189 0 my $self = shift;
190 0 my $ident = ident $self;
191 0 my ($ro) = validate_pos( @_, { type => ARRAYREF } );
192 0 $self->set_ro_all(0);
193 0 $ro_of{$ident} = $ro;
194 }
195  
196 0 ▶ sub has_ro {
Subroutine has_ro: not called CC=1 SCAR=6.9
Pod documented
197 0 my $self = shift;
198 0 my $ident = ident $self;
199 0 my ($ro) = validate_pos( @_, { type => SCALAR } );
200 0 return grep { $_ eq $ro } @{ $ro_of{$ident} };
201 }
202  
203 0 ▶ sub add_ro {
Subroutine add_ro: not called CC=3 SCAR=24.8
Pod documented
204 0 my $self = shift;
205 0 my $ident = ident $self;
206 0 my ($ro) = validate_pos( @_, { type => SCALAR } );
207 0 ▶ if ( $self->get_ro_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_ro_all) { } 0 0 0
208 0 return;
209 } else {
210 0 ▶ if ( not $self->has_ro( $ro ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->has_ro($ro)) 0 0 0
211 0 push @{ $ro_of{$ident} }, $ro;
212 }
213 }
214 0 return 1;
215 }
216  
217 0 ▶ sub remove_ro {
Subroutine remove_ro: not called CC=3 SCAR=24.8
Pod documented
218 0 my $self = shift;
219 0 my $ident = ident $self;
220 0 my ($ro) = validate_pos( @_, { type => SCALAR } );
221 0 ▶ if ( $self->get_ro_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_ro_all) { } 0 0 0
222 0 return;
223 } else {
224 0 ▶ if ( $self->has_ro( $ro ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_ro($ro)) 0 0 0
225 0 $ro_of{$ident} = [ grep { $_ ne $ro } @{ $ro_of{$ident} } ];
226 }
227 }
228 0 return 1;
229 }
230  
231 0 ▶ sub get_sec {
Subroutine get_sec: not called CC=1 SCAR=6.9
Pod documented
232 0 my $self = shift;
233 0 my $ident = ident $self;
234 0 return @{ $sec_of{$ident} };
235 }
236  
237 0 ▶ sub set_sec {
Subroutine set_sec: not called CC=1 SCAR=6.9
Pod documented
238 0 my $self = shift;
239 0 my $ident = ident $self;
240 0 my ($sec) = validate_pos( @_, { type => ARRAYREF } );
241 0 $sec_of{$ident} = $sec;
242 }
243
244 0 ▶ sub has_sec {
Subroutine has_sec: not called CC=1 SCAR=6.9
Pod documented
245 0 my $self = shift;
246 0 my $ident = ident $self;
247 0 my ($sec) = validate_pos( @_, { type => SCALAR } );
248 0 return grep { $_ eq $sec } @{ $sec_of{$ident} };
249 }
250  
251 0 ▶ sub add_sec {
Subroutine add_sec: not called CC=2 SCAR=17.9
Pod documented
252 0 my $self = shift;
253 0 my $ident = ident $self;
254 0 my ($sec) = validate_pos( @_, { type => SCALAR } );
255 0 ▶ if ( not $self->has_sec( $sec ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->has_sec($sec)) 0 0 0
256 0 push @{ $sec_of{$ident} }, $sec;
257 }
258 }
259  
260 0 ▶ sub remove_sec {
Subroutine remove_sec: not called CC=2 SCAR=17.9
Pod documented
261 0 my $self = shift;
262 0 my $ident = ident $self;
263 0 my ($sec) = validate_pos( @_, { type => SCALAR } );
264 0 ▶ if ( $self->has_sec( $sec ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_sec($sec)) 0 0 0
265 0 $sec_of{$ident} = [ grep { $_ ne $sec } @{ $sec_of{$ident} } ];
266 }
267 }
268  
269 0 ▶ sub get_root {
Subroutine get_root: not called CC=1 SCAR=6.9
Pod documented
270 0 my $self = shift;
271 0 my $ident = ident $self;
272 0 return @{ $root_of{$ident} };
273 }
274  
275 0 ▶ sub set_root {
Subroutine set_root: not called CC=1 SCAR=6.9
Pod documented
276 0 my $self = shift;
277 0 my $ident = ident $self;
278 0 my ($root) = validate_pos( @_, { type => ARRAYREF } );
279 0 $root_of{$ident} = $root;
280 }
281  
282 0 ▶ sub has_root {
Subroutine has_root: not called CC=1 SCAR=6.9
Pod documented
283 0 my $self = shift;
284 0 my $ident = ident $self;
285 0 my ($root) = validate_pos( @_, { type => SCALAR } );
286 0 return grep { $_ eq $root } @{ $root_of{$ident} };
287 }
288  
289 0 ▶ sub add_root {
Subroutine add_root: not called CC=2 SCAR=17.9
Pod documented
290 0 my $self = shift;
291 0 my $ident = ident $self;
292 0 my ($root) = validate_pos( @_, { type => SCALAR } );
293 0 ▶ if ( not $self->has_root( $root ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->has_root($root)) 0 0 0
294 0 push @{ $root_of{$ident} }, $root;
295 }
296 }
297  
298 0 ▶ sub remove_root {
Subroutine remove_root: not called CC=2 SCAR=17.9
Pod documented
299 0 my $self = shift;
300 0 my $ident = ident $self;
301 0 my ($root) = validate_pos( @_, { type => SCALAR } );
302 0 ▶ if ( $self->has_root( $root ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_root($root)) 0 0 0
303 0 $root_of{$ident} = [ grep { $_ ne $root } @{ $root_of{$ident} } ];
304 }
305 }
306  
307 0 ▶ sub update {
Subroutine update: not called CC=12 SCAR=50.5
Pod documented
308  
309 0 my $self = shift;
310 0 my $ident = ident $self;
311  
312 0 my @options = ();
313  
314 0 ▶ if ( $self->get_actual ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_actual) 0 0 0
315 0 push @options, "actual=" . $self->get_actual;
316 }
317  
318 0 ▶ if ( defined $self->get_anon ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->get_anon) 0 0 0
319 0 push @options, "anon=" . $self->get_anon;
320 }
321  
322 0 ▶ if ( $self->get_nosuid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_nosuid) 0 0 0
323 0 push @options, "nosuid";
324 }
325  
326 0 ▶ if ( $self->get_ro_all ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->get_ro_all) { } 0 0 0
elsif (my(@ro) = $self->get_ro) { } 0 0 0
327 0 push @options, "ro";
328 } elsif ( my @ro = $self->get_ro ) {
329 0 push @options, "ro=" . join( ':', @ro );
330 }
331  
332 0 ▶ if ( $self->get_rw_all ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->get_rw_all) { } 0 0 0
elsif (my(@rw) = $self->get_rw) { } 0 0 0
333 0 push @options, "rw";
334 } elsif ( my @rw = $self->get_rw ) {
335 0 push @options, "rw=" . join( ':', @rw );
336 }
337  
338 0 ▶ if ( my @root = $self->get_root ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@root) = $self->get_root) 0 0 0
339 0 push @options, "root=" . join( ':', @root );
340 }
341  
342 0 ▶ if ( my @sec = $self->get_sec ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@sec) = $self->get_sec) 0 0 0
343 0 push @options, "sec=" . join( ':', @sec );
344 }
345  
346 0 my $options = join ',', @options;
347  
348 0 ▶ my $argument =
Branch: 1 branch
BranchTrueFalseTotal
$self->get_type eq 'permanent' ? : 0 0 0
349 $self->get_type eq 'permanent' ? '-p' : '-io';
350
351 0 $self->get_filer->_run_command(
352 command => [
353 'exportfs', $argument, $options, $self->get_path,
354 ],
355 );
356  
357 0 ▶ if ( $self->get_type eq 'permanent' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_type eq "permanent") 0 0 0
358 0 $active_of{$ident} = 1;
359 }
360  
361 0 return 1;
362  
363 }
364  
365 0 ▶ sub compare {
Subroutine compare: not called CC=20 SCAR=60.4
Pod documented
366  
367 0 my $self = shift;
368 0 my ($other) = validate_pos(
369 @_,
370 { isa => 'NetApp::Filer::Export' },
371 );
372  
373 0 ▶ if ( $self->get_actual ne $other->get_actual ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_actual ne $other->get_actual) 0 0 0
374 0 return;
375 }
376  
377 0 ▶ if ( $self->get_nosuid ne $other->get_nosuid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_nosuid ne $other->get_nosuid) 0 0 0
378 0 return;
379 }
380  
381 0 ▶ if ( defined $self->get_anon && defined $other->get_anon ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->get_anon and defined $other->get_anon) { } 0 0 0
elsif (defined $self->get_anon or defined $other->get_anon) { } 0 0 0
Condition0%0/3
defined $self->get_anon and defined $other->get_anon
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->get_anon and defined $other->get_anon
defined $self->get_anon defined $other->get_anon
Truth table0%0/3
A and B
A= defined $self->get_anonB= defined $other->get_anon
ABresult
0X0
100
111
382 0 ▶ if ( $self->get_anon ne $other->get_anon ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_anon ne $other->get_anon) 0 0 0
383 0 return;
384 }
385 ▶ } elsif ( defined $self->get_anon || defined $other->get_anon ) {
Condition0%0/3
defined $self->get_anon or defined $other->get_anon
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $self->get_anon or defined $other->get_anon
defined $self->get_anon defined $other->get_anon
Truth table0%0/3
A or B
A= defined $self->get_anonB= defined $other->get_anon
ABresult
1X1
011
000
386 0 return;
387 }
388  
389 0 ▶ if ( $self->get_rw_all && ! $other->get_rw_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_rw_all and not $other->get_rw_all) 0 0 0
Condition0%0/3
$self->get_rw_all and not $other->get_rw_all
!ll&&!rl&&r
000
MC/DC0%0/2
$self->get_rw_all and not $other->get_rw_all
$self->get_rw_all not $other->get_rw_all
Truth table0%0/3
A and not(B)
A= $self->get_rw_allB= not $other->get_rw_all
ABresult
0X0
100
111
390 0 return;
391 }
392  
393 0 ▶ if ( ! $self->get_rw_all && $other->get_rw_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->get_rw_all and $other->get_rw_all) 0 0 0
Condition0%0/3
not $self->get_rw_all and $other->get_rw_all
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->get_rw_all and $other->get_rw_all
not $self->get_rw_all $other->get_rw_all
Truth table0%0/3
not(A) and B
A= not $self->get_rw_allB= $other->get_rw_all
ABresult
0X0
100
111
394 0 return;
395 }
396  
397 0 ▶ if ( $self->get_ro_all && ! $other->get_ro_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_ro_all and not $other->get_ro_all) 0 0 0
Condition0%0/3
$self->get_ro_all and not $other->get_ro_all
!ll&&!rl&&r
000
MC/DC0%0/2
$self->get_ro_all and not $other->get_ro_all
$self->get_ro_all not $other->get_ro_all
Truth table0%0/3
A and not(B)
A= $self->get_ro_allB= not $other->get_ro_all
ABresult
0X0
100
111
398 0 return;
399 }
400  
401 0 ▶ if ( ! $self->get_ro_all && $other->get_ro_all ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->get_ro_all and $other->get_ro_all) 0 0 0
Condition0%0/3
not $self->get_ro_all and $other->get_ro_all
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->get_ro_all and $other->get_ro_all
not $self->get_ro_all $other->get_ro_all
Truth table0%0/3
not(A) and B
A= not $self->get_ro_allB= $other->get_ro_all
ABresult
0X0
100
111
402 0 return;
403 }
404  
405 0 ▶ if ( join( ',', sort $self->get_rw) ne
Branch: 1 branch
BranchTrueFalseTotal
if (join(",", sort($self->get_rw)) ne join(",", sort($other->get_rw))) 0 0 0
406 join( ',', sort $other->get_rw ) ) {
407 0 return;
408 }
409  
410 0 ▶ if ( join( ',', sort $self->get_ro) ne
Branch: 1 branch
BranchTrueFalseTotal
if (join(",", sort($self->get_ro)) ne join(",", sort($other->get_ro))) 0 0 0
411 join( ',', sort $other->get_ro ) ) {
412 0 return;
413 }
414  
415 0 ▶ if ( join( ',', sort $self->get_sec) ne
Branch: 1 branch
BranchTrueFalseTotal
if (join(",", sort($self->get_sec)) ne join(",", sort($other->get_sec))) 0 0 0
416 join( ',', sort $other->get_sec ) ) {
417 0 return;
418 }
419  
420 0 ▶ if ( join( ',', sort $self->get_root) ne
Branch: 1 branch
BranchTrueFalseTotal
if (join(",", sort($self->get_root)) ne join(",", sort($other->get_root))) 0 0 0
421 join( ',', sort $other->get_root ) ) {
422 0 return;
423 }
424  
425 0 return 1;
426  
427 }
428  
429 }
430  
431 7 ▶sub _parse_export {
Subroutine _parse_export: called CC=10 SCAR=23.1
432  
433 4 my $class = shift;
434 4 my $line = shift;
435  
436 4 chomp($line);
437 4 $line =~ s/\s*$//;
438  
439 4 my ($path,$options) = split /\s+/, $line, 2;
440  
441 4 chomp($options);
442 4 $options =~ s/^-//;
443  
444 4 my $export = {
445 path => $path,
446 };
447  
448 4 foreach my $option ( split /,/, $options ) {
449  
450 10 my ($key,$value) = split /=/, $option;
451  
452 10 ▶ if ( $key eq 'nosuid' ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($key eq 'nosuid') { } 1 9 10
elsif ($key eq 'ro' or $key eq 'rw') { } 4 5 9
elsif ($key eq 'sec' or $key eq 'root') { } 4 1 5
elsif ($key eq 'actual' or $key eq 'anon') { } 1 0 1
453 1 $export->{$key} = 1
454 ▶ } elsif ( $key eq 'ro' || $key eq 'rw' ) {
Condition100%3/3
$key eq "ro" or $key eq "rw"
l!l&&r!l&&!r
225
MC/DC100%2/2
$key eq "ro" or $key eq "rw"
$key eq "ro" $key eq "rw"
Truth table100%3/3
A or B
A= $key eq "ro"B= $key eq "rw"
ABresult
1X1
011
000
455 4 ▶ if ( $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 2 2 4
456 2 $export->{$key} = [ split /:/, $value ];
457 } else {
458 2 $export->{ $key . '_all' } = 1;
459 }
460 ▶ } elsif ( $key eq 'sec' || $key eq 'root' ) {
Condition100%3/3
$key eq "sec" or $key eq "root"
l!l&&r!l&&!r
311
MC/DC100%2/2
$key eq "sec" or $key eq "root"
$key eq "sec" $key eq "root"
Truth table100%3/3
A or B
A= $key eq "sec"B= $key eq "root"
ABresult
1X1
011
000
461 4 $export->{$key} = [ split /:/, $value ];
462 ▶ } elsif ( $key eq 'actual' || $key eq 'anon' ) {
Condition33%1/3
$key eq "actual" or $key eq "anon"
l!l&&r!l&&!r
100
MC/DC0%0/2
$key eq "actual" or $key eq "anon"
$key eq "actual" $key eq "anon"
Truth table33%1/3
A or B
A= $key eq "actual"B= $key eq "anon"
ABresult
1X1
011
000
463 1 $export->{$key} = $value;
464 } else {
465 0 croak(
466 "Unrecognized export option '$key'\n",
467 "Exports entry: $line\n",
468 );
469 }
470  
471 }
472  
473 4 return $export;
474  
475 }
476  
477 7 1;
↑ Summary NetApp/Filer.pm »