CfgTie/TieGroup.pm

filter: Statementstmt 14.7% 29 / 197 Branchbran 11.2% 7 / 62 Conditioncond 11.1% 2 / 18 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 11.4% 4 / 35 Podpod 0.0% 0 / 2 totaltotal 12.9% 42 / 325 CC 42 SCAR 26.6
CC
42
Cov
14%
EXISTS
56.0
HTML
30.0
EXISTS
20.0
CRAP 14.3
« CfgTie/TieNamed.pm ↑ Summary CfgTie/TieMTab.pm »
1 #!/usr/bin/perl -Tw
2 #Copyright 1998-2001, Randall Maas. All rights reserved. This program is free
3 #software; you can redistribute it and/or modify it under the same terms as
4 #PERL itself.
5  
6 package CfgTie::TieGroup;
7 1 require CfgTie::filever;
8 1 require CfgTie::Cfgfile;
9  
10 =head1 NAME
11  
12 CfgTie::TieGroup -- an associative array of group names and ids to information
13  
14 =head1 SYNOPSIS
15  
16 Makes the groups database available as regular hash
17  
18 tie %group,'CfgTie::TieGroup'
19 $group{'myfriends'}=['jonj', @{$group{'myfriends'}];
20  
21 or
22  
23 tie %group,'CfgTie::TieGroup', 'mygroupfile'
24  
25 =head1 DESCRIPTION
26  
27 This is a straight forward hash tie that allows us to access the user group
28 database sanely.
29  
30 It cross ties with the user package and the mail packages
31  
32 =head2 Ties
33  
34 There are two ties available for programmers:
35  
36 =over 1
37  
38 =item C<tie %group,'CfgTie::TieGroup'>
39  
40 C<$group{$name}> will return a hash reference of the named group information.
41  
42 =item C<tie %group_id,'CfgTie::Group_id'>
43  
44 C<$group_id{$id}> will return a HASH reference for the specified group.
45  
46 =back
47  
48 =head2 Structure of hash
49  
50 Any given group entry has the following information assoicated with it:
51  
52 =over 1
53  
54 =item C<name>
55  
56 =item C<id>
57  
58 =item C<members>
59  
60 A list reference to all of the users that are part of this group.
61  
62 =item C<_members>
63  
64 A list reference to all of the users that are explicitly listed in the
65 F</etc/group> file.
66  
67 =back
68  
69  
70 Plus an (probably) obsolete fields:
71  
72 =over 1
73  
74 =item C<Password>
75  
76 This is the encrypted password, but will probably be obsolete.
77  
78 =back
79  
80 Each of these entries can be modified (even deleted), and they will be
81 reflected in the overall system. Additionally, the programmer can set any
82 other associated key, but this information will only be available to a running
83 Perl script.
84  
85 =head2 Additional Routines
86  
87 =over 1
88  
89 =item C<(tied %MyHash)->files()>
90  
91 Returns a list of files employed.
92  
93 =item C<&CfgTie::TieGroup'status()>
94  
95 =item C<&CfgTie::TieGroup_id'status()>
96  
97 Will return C<stat> information on the group database.
98  
99  
100 =back
101  
102 =head2 Miscellaneous
103  
104 C<$CfgTie::TieGroup_rec'groupmod> contains the path to the program F<groupmod>.
105 This can be modified as required.
106  
107 C<$CfgTie::TieGroup_rec'groupadd> contains the path to the program F<groupadd>.
108 This can be modified as required.
109  
110 C<$CfgTie::TieGroup_rec'groupdel> contains the path to the program F<groupdel>.
111 This can be modified as required.
112  
113 =head1 Files
114  
115 F</etc/passwd>
116 F</etc/group>
117 F</etc/gshadow>
118 F</etc/shadow>
119  
120 =head1 See Also
121  
122 L<CfgTie::Cfgfile>, L<CfgTie::TieAliases>, L<CfgTie::TieGeneric>,
123 L<CfgTie::TieHost>, L<CfgTie::TieMTab>, L<CfgTie::TieNamed>,
124 L<CfgTie::TieNet>, L<CfgTie::TiePh>, L<CfgTie::TieProto>,
125 L<CfgTie::TieRCService>, L<CfgTie::TieRsrc>, L<CfgTie::TieServ>,
126 L<CfgTie::TieShadow>, L<CfgTie::TieUser>
127  
128 L<group(5)>,
129 L<passwd(5)>,
130 L<shadow(5)>,
131 L<groupmod(8)>,
132 L<groupadd(8)>,
133 L<groupdel(8)>
134  
135 =head1 Caveats
136  
137 The current version does cache some group information.
138  
139 =head1 Author
140  
141 Randall Maas (L<mailto:randym@acm.org>, L<http://www.hamline.edu/~rcmaas/>)
142  
143 =cut
144  
145 sub status
146 0 ▶{
Subroutine status: not called CC=1 SCAR=6.9
Pod undocumented
147 # the information for the /etc/group file
148 0 stat '/etc/group';
149 }
150  
151 sub TIEHASH
152 2 ▶{
Subroutine TIEHASH: called CC=2 SCAR=6.9
153 2 my $self = shift;
154 2 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 1 2
155 {
156 1 return CfgTie::TieGroup_file->TIEHASH(@_);
157 }
158 1 my $node = {};
159 1 return bless $node, $self;
160 }
161  
162 sub FIRSTKEY
163 0 ▶{
Subroutine FIRSTKEY: not called CC=1 SCAR=6.9
164 0 my $self = shift;
165  
166 #Rewind outselves to the beginning.
167 0 setgrent;
168  
169 0 &NEXTKEY($self);
170 }
171  
172 sub NEXTKEY
173 0 ▶{
Subroutine NEXTKEY: not called CC=2 SCAR=17.9
174 0 my $self = shift;
175  
176 #Get the next group id in the database.
177 # Get the information from the system and store it for later
178 0 my @x = getgrent;
179 0 ▶ if (!scalar @x) {return;}
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @x) 0 0 0
180  
181 0 tie %{$CfgTie::TieGroup_rec'by_name{$x[0]}}, 'CfgTie::TieGroup_rec',@x;
182 0 return $x[0]; #Corresponds to the name
183 }
184  
185 sub EXISTS
186 0 ▶{
Subroutine EXISTS: not called CC=3 SCAR=24.8
187 0 my ($self,$name) = @_;
188 0 my $lname =lc($name);
189 0 ▶ if (exists $CfgTie::TieGroup_rec'by_name{$lname}) {return 1;}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $CfgTie::TieGroup_rec::by_name{$lname}) 0 0 0
190  
191 # Get the information from the system and store it for later
192 0 my @x = getgrnam $name;
193 0 ▶ if (! scalar @x) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @x) 0 0 0
194  
195 0 tie %{$CfgTie::TieGroup_rec'by_name{$lname}}, 'CfgTie::TieGroup_rec',@x;
196 0 return 1;
197 }
198  
199 sub FETCH
200 0 ▶{
Subroutine FETCH: not called CC=3 SCAR=24.8
201 0 my ($self, $name) = @_;
202 0 ▶ if (!defined $name) {return undef;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $name) 0 0 0
203 0 my $lname = lc($name);
204  
205 #check out our cache first
206 0 ▶ if (EXISTS($self,$lname))
Branch: 1 branch
BranchTrueFalseTotal
if (EXISTS($self, $lname)) 0 0 0
207 0 {return $CfgTie::TieGroup_rec'by_name{$lname};}
208  
209 0 return undef;
210 }
211  
212 #Bug creating groups is not supported yet.
213 sub STORE
214 0 ▶{
Subroutine STORE: not called CC=1 SCAR=6.9
215 0 my ($self,$key,$val) = @_;
216 # groupadd or groupmod, depending
217 }
218  
219 #Bug need to consider how vigorously we delete things -r ? /var/mail/me, etc
220 sub DELETE
221 0 ▶{
Subroutine DELETE: not called CC=2 SCAR=17.9
222 0 my $self = shift;
223 0 my $name = shift;
224  
225 #Basically delete the group now.
226 0 CfgTie::filever::system("$CfgTie::TieGroup_rec'groupdel $name");
227  
228 #Remove it from our cache
229 0 ▶ if (exists $CfgTie::TieGroup_rec'by_name{$name})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $CfgTie::TieGroup_rec::by_name{$name}) 0 0 0
230 0 {delete $CfgTie::TieGroup_rec'by_name{$name};}
231 }
232  
233 sub HTML($$)
234 0 ▶{
Subroutine HTML: not called CC=5 SCAR=34.0
Pod undocumented
235 0 my ($self,$CodeRef)=@_;
236 0 my %A;
237 0 ▶ for (my $I=FIRSTKEY($self); $I; $I=NEXTKEY($self,$I))
Branch: 1 branch
BranchTrueFalseTotal
if ($I) 0 0 0
238 {
239 0 my $U=FETCH($self,$I);
240 #See if the caller wants us to pass
241 0 ▶ if (defined $CodeRef && !&$CodeRef($U)) {next;}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $CodeRef and not &$CodeRef($U)) 0 0 0
Condition0%0/3
defined $CodeRef and not &$CodeRef($U)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $CodeRef and not &$CodeRef($U)
defined $CodeRef not &$CodeRef($U)
Truth table0%0/3
A and not(B)
A= defined $CodeRefB= not &$CodeRef($U)
ABresult
0X0
100
111
242 $A{$I} = CfgTie::Cfgfile::trx(
243 "<a href=\"group/$I\">$I</a>",
244 join(', ',
245 0 map {"<a href=\"user/$_\">$_</a>"} (sort @{$U->{'members'}}))
246 );
247 }
248 0 my $Us;
249 0 foreach my $I (sort keys %A) {$Us.=$A{$I};}
250 0 CfgTie::Cfgfile::table('Groups', $Us, 2);
251 }
252  
253 package CfgTie::TieGroup_id;
254  
255 sub status
256 0 ▶{
Subroutine status: not called CC=1 SCAR=6.9
257 # the information for the /etc/group file
258 0 stat '/etc/group';
259 }
260  
261  
262 sub TIEHASH
263 0 ▶{
Subroutine TIEHASH: not called CC=1 SCAR=6.9
264 0 my $self = shift;
265 0 my $node = {};
266 0 return bless $node, $self;
267 }
268  
269 sub FIRSTKEY
270 0 ▶{
Subroutine FIRSTKEY: not called CC=1 SCAR=6.9
271 0 my $self = shift;
272  
273 #Rewind outselves to the beginning.
274 0 setgrent;
275  
276 0 &NEXTKEY($self);
277 }
278  
279 sub NEXTKEY
280 0 ▶{
Subroutine NEXTKEY: not called CC=2 SCAR=17.9
281 0 my $self = shift;
282  
283 #Get the next group id in the database.
284 # Get the information from the system and store it for later
285 0 my @x = getgrent;
286 0 ▶ if (! scalar @x) {return;}
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @x) 0 0 0
287  
288 0 tie %{$CfgTie::TieGroup_rec'by_name{$x[0]}}, 'CfgTie::TieGroup_rec',@x;
289 0 return $x[2]; #Corresponds to the id
290 }
291  
292 sub EXISTS
293 0 ▶{
Subroutine EXISTS: not called CC=4 SCAR=30.0
294 0 my ($self,$id) = @_;
295 0 ▶ if (!defined $id) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $id) 0 0 0
296  
297 0 ▶ if (exists $CfgTie::TieGroup_rec'by_id{$id}) {return 1;}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $CfgTie::TieGroup_rec::by_id{$id}) 0 0 0
298  
299 # Get the information from the system and store it for later
300 0 my @x = getgrgid $id;
301 0 ▶ if (! scalar @x) {return 0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @x) 0 0 0
302  
303 0 tie %{$CfgTie::TieGroup_rec'by_name{$x[0]}}, 'CfgTie::TieGroup_rec',@x;
304 0 $CfgTie::TieGroup_rec'by_id{$id} = $CfgTie::TieGroup_rec'by_name{$x[0]};
305  
306 0 return 1;
307 }
308  
309 sub FETCH
310 0 ▶{
Subroutine FETCH: not called CC=2 SCAR=17.9
311 0 my ($self,$id) = @_;
312  
313 #check out our cache first
314 0 ▶ if (EXISTS($self,$id))
Branch: 1 branch
BranchTrueFalseTotal
if (EXISTS($self, $id)) 0 0 0
315 0 {return $CfgTie::TieGroup_rec'by_id{$id};}
316  
317 0 return undef;
318 }
319  
320 #Bug creating groups is not supported yet.
321 sub STORE
322 0 ▶{
Subroutine STORE: not called CC=1 SCAR=6.9
323 0 my ($self,$key,$val) = @_;
324 # groupadd or groupmod, depending
325 }
326  
327 #Bug need to consider how vigorously we delete things -r ? /var/mail/me, etc
328 sub DELETE
329 0 ▶{
Subroutine DELETE: not called CC=3 SCAR=24.8
330 0 my ($self,$id) = @_;
331  
332 0 ▶ if (!exists $CfgTie::TieGroup_rec'by_id{$id})
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $CfgTie::TieGroup_rec::by_id{$id}) 0 0 0
333 {
334 #Try to look up the group id
335 0 &FETCH($self,$id);
336 }
337
338 0 ▶ if (exists $CfgTie::TieGroup_rec'by_id{$id})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $CfgTie::TieGroup_rec::by_id{$id}) 0 0 0
339 {
340 #Basically delete the group now.
341 CfgTie::filever::system("$CfgTie::TieGroup_rec'groupdel ".
342 0 $CfgTie::TieGroup_rec'by_id{$id}->{Name});
343  
344 #Remove it from out cache
345 0 delete $CfgTie::TieGroup_rec'by_id{$id};
346 }
347 }
348  
349  
350  
351 package CfgTie::TieGroup_rec;
352 # A package used by both group_id and group to retain record information about
353 # a person. This is the only way to access groupmod.
354  
355 #Two hashes are used for look up
356 # $by_name{$name}
357 # $by_id{$id}
358  
359 1 ▶use CfgTie::TieUser;
Subroutine BEGIN: called CC=1 SCAR=0.0
360 1 my %Users;
361 1 tie %Users, 'CfgTie::TieUser';
362 sub uniq ($)
363 0 ▶{
Subroutine uniq: not called CC=4 SCAR=30.0
364 0 my $L=shift;
365 0 my @Ret=();
366 0 my $J;
367 0 foreach my $I (sort @{$L})
368 0 ▶ {if (!defined $J || $J ne $I) {$J=$I; push @Ret,$I;}}
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $J or $J ne $I) 0 0 0
Condition0%0/3
not defined $J or $J ne $I
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $J or $J ne $I
not defined $J $J ne $I
Truth table0%0/3
not(A) or B
A= not defined $JB= $J ne $I
ABresult
1X1
011
000
369 0 [@Ret];
370 }
371  
372 0 ▶sub new {TIEHASH(@_);}
Subroutine new: not called CC=1 SCAR=6.9
373 sub TIEHASH
374 0 ▶{
Subroutine TIEHASH: not called CC=3 SCAR=24.8
375 # Ties a single group to a register...
376 0 my ($self,$Name,@Rest) = @_;
377 0 my $Node={};
378 0 my $lname = lc($Name);
379  
380 0 ▶ if (scalar @Rest)
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @Rest) 0 0 0
381 {
382 0 ($Node->{password},$Node->{id}, $Node->{_members})=@Rest;
383 0 $Node->{_members}=[split(/\s*(?:,|\s)\s*/, $Node->{_members})];
384 }
385  
386 0 ▶ if (defined $Name) {$Node->{name}=$Name;}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Name) 0 0 0
387  
388 0 return bless $Node, $self;
389 }
390  
391 sub FIRSTKEY ($)
392 0 ▶{
Subroutine FIRSTKEY: not called CC=1 SCAR=6.9
393 0 my $self = shift;
394 0 EXISTS($self,'members');
395 0 my $a = keys %{$self};
396 0 return scalar each %{$self};
397 }
398  
399 sub NEXTKEY
400 0 ▶{
Subroutine NEXTKEY: not called CC=1 SCAR=6.9
401 0 my $self = shift;
402 0 return scalar each %{$self};
403 }
404  
405 sub EXISTS ($$)
406 0 ▶{
Subroutine EXISTS: not called CC=7 SCAR=40.3
407 0 my ($self,$key) = @_;
408 0 my $lkey=lc($key);
409  
410 0 ▶ if (exists $self->{$lkey}) {return 1;}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$lkey}) 0 0 0
411 0 ▶ if ($lkey eq 'members' && defined $self->{id})
Branch: 1 branch
BranchTrueFalseTotal
if ($lkey eq "members" and defined $self->{"id"}) 0 0 0
Condition0%0/3
$lkey eq "members" and defined $self->{"id"}
!ll&&!rl&&r
000
MC/DC0%0/2
$lkey eq "members" and defined $self->{"id"}
$lkey eq "members" defined $self->{"id"}
Truth table0%0/3
A and B
A= $lkey eq "members"B= defined $self->{"id"}
ABresult
0X0
100
111
412 {
413 0 my @Mems=@{$self->{_members}};
414 0 foreach my $I (keys %Users)
415 {
416 0 ▶ if (exists $Users{$I}->{'groupid'} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $Users{$I}{"groupid"} and $Users{$I}{"groupid"} == $self->{"id"}) 0 0 0
Condition0%0/3
exists $Users{$I}{"groupid"} and $Users{$I}{"groupid"} == $self->{"id"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $Users{$I}{"groupid"} and $Users{$I}{"groupid"} == $self->{"id"}
exists $Users{$I}{"groupid"} $Users{$I}{"groupid"} == $self->{"id"}
Truth table0%0/3
A and B
A= exists $Users{$I}{"groupid"}B= $Users{$I}{"groupid"} == $self->{"id"}
ABresult
0X0
100
111
417 $Users{$I}->{'groupid'} == $self->{id})
418 0 {push @Mems, $I;}
419 }
420 0 $self->{members}=uniq(\@Mems);
421 0 return 1;
422 }
423  
424 0 return 0;
425 }
426  
427 sub FETCH
428 0 ▶{
Subroutine FETCH: not called CC=2 SCAR=17.9
429 0 my ($self,$key) = @_;
430 0 my $lkey = lc($key);
431 0 ▶ if (EXISTS($self,$lkey)) {return $self->{$lkey};}
Branch: 1 branch
BranchTrueFalseTotal
if (&EXISTS($self, $lkey)) 0 0 0
432 0 return undef;
433 }
434  
435 # Maps the changes to a particular setting to a flag on the command line
436 1 $groupmod_opt =
437 {
438 name => '-n',
439 id => '-g',
440 };
441  
442 1 $groupmod = '/usr/sbin/groupmod'; #Hard path to groupmod
443 1 $groupdel = '/usr/sbin/groupdel'; #Hard path to groupdel
444  
445 sub STORE
446 0 ▶{
Subroutine STORE: not called CC=3 SCAR=24.8
447 # Changes a setting for the specified group... we basically call groupmod
448 0 my ($self,$key,$val) = @_;
449 0 my $lkey = lc($key);
450  
451 0 ▶ if ($lkey eq 'groups')
Branch: 1 branch
BranchTrueFalseTotal
if ($lkey eq "groups") 0 0 0
452 {
453 #Handle the groups thing...
454  
455 #$val is a list reference....
456 0 my ($i,@g) = @{$val};
457  
458 0 CfgTie::filever::system("$groupmod $self->{Name} -g $i -G ".
459 join(',', @g));
460 }
461 0 ▶ if (exists $groupmod_opt{$lkey})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $groupmod_opt{$lkey}) { } 0 0 0
462 {
463 #This is something for group mod!
464 CfgTie::filever::system("$groupmod $groupmod_opt{$lkey} $val ".
465 0 $self->{Name});
466 }
467 else
468 {
469 #Extra setting that will be lost... 8(
470 0 $self->{$lkey}=$val;
471 }
472 }
473  
474 sub DELETE
475 0 ▶{
Subroutine DELETE: not called CC=3 SCAR=24.8
476 #Deletes a group setting
477 0 my ($self, $key) = @_;
478 0 my $lkey=lc($key);
479  
480 0 ▶ if ($lkey eq 'authmethod')
Branch: 2 branches
BranchTrueFalseTotal
if ($lkey eq 'authmethod') { } 0 0 0
elsif (exists $groupmod_opt->{$lkey}) { } 0 0 0
481 {
482 0 CfgTie::filever::system("$groupmod -A DEFAULT $self->{name}");
483 }
484 elsif (exists $groupmod_opt->{$lkey})
485 {
486 #This is something for group mod!
487 CfgTie::filever::system("$groupmod $self->{name} ".
488 0 $groupmod_opt->{$lkey});
489 }
490 else
491 {
492 #Just remove our local copy
493 0 delete $self->{$lkey};
494 }
495 }
496  
497  
498 0 ▶sub trx {CfgTie::Cfgfile::trx(@_);}
Subroutine trx: not called CC=1 SCAR=6.9
499 0 ▶sub table {CfgTie::Cfgfile::table(@_);}
Subroutine table: not called CC=1 SCAR=6.9
500 sub HTML($)
501 0 ▶{
Subroutine HTML: not called CC=2 SCAR=17.9
502 # A routine to HTMLize the user
503 0 my $self=shift;
504  
505 0 my %Keys2 = map {$_,1} (keys %{$self});
506  
507 0 delete $Keys2{name};
508 0 delete $Keys2{id};
509 0 delete $Keys2{password};
510 0 delete $Keys2{members};
511 0 delete $Keys2{_members};
512 #Members is dynamically computed...
513 0 EXISTS($self, 'members');
514  
515 0 my $A='';
516 0 foreach my $I (sort keys %Keys2)
517 0 {$A.=trx($I,$self->{$I});}
518 table($self->{name},
519 trx("Name:",$self->{name}).
520 trx("Id:",$self->{id}).
521 trx("Members:",
522 join(', ',
523 0 map {"<a href=\"user/$_\">$_</a>"} (sort @{$self->{'members'}})))
524 .$A
525 );
526 }
527  
528 package CfgTie::TieGroup_file;
529 1 ▶use CfgTie::Cfgfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
530 1 @ISA=qw(CfgTie::Cfgfile);
531  
532 sub files
533 0 ▶{
Subroutine files: not called CC=1 SCAR=6.9
534 0 $self->{'Path'};
535 }
536  
537 sub status
538 0 ▶{
Subroutine status: not called CC=1 SCAR=6.9
539 # the information for the file
540 0 stat $self->{'Path'};
541 }
542  
543 sub scan
544 1 ▶{
Subroutine scan: called CC=7 SCAR=21.5
545 1 my $self=shift;
546  
547 #Check to see what the path is
548 1 ▶ if (!exists $self->{'Path'})
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Path"}) 0 1 1
549 {
550 0 return;
551 }
552  
553 1 my $F= new Secure::File "<".$self->{'Path'};
554 1 ▶ return unless defined $F;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $F 0 1 1
555  
556 1 ▶ while (<$F>)
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $F)) 3 1 4
557 {
558 #Chop of the comments
559 3 s/\s*#.*$//;
560 3 my @x = split /:/;
561 3 ▶ if (@x && defined $x[0] && length $x[0])
Branch: 1 branch
BranchTrueFalseTotal
if (@x and defined $x[0] and length $x[0]) 3 0 3
Condition33%2/6
@x and defined $x[0] and length $x[0]
!ll&&!rl&&r
003
@x and defined $x[0]
!ll&&!rl&&r
003
MC/DC0%0/3
@x and defined $x[0] and length $x[0]
@x defined $x[0] length $x[0]
Truth table25%1/4
A and B and C
A= @xB= defined $x[0]C= length $x[0]
ABCresult
0XX0
10X0
1100
1111
562 {
563 3 $self->{Contents}->{$x[0]}={
564 'name' =>$x[0],
565 'passwd' =>$x[1],
566 'id' =>$x[2],
567 'members'=>[split(/(?:\s+|\,)/, $x[3])]
568 };
569 }
570 }
571  
572 1 $F->close;
573 }
574  
575 sub format($$)
576 0 ▶{
Subroutine format: not called CC=1 SCAR=6.9
577 0 "$_[1]: ".join(',',@{$_[1]})."\n";
578 }
« CfgTie/TieNamed.pm ↑ Summary CfgTie/TieMTab.pm »