File Coverage

blib/lib/SVN/Access/Group.pm
Criterion Covered Total %
statement 18 35 51.4
branch 0 6 0.0
condition n/a
subroutine 6 9 66.6
pod 6 6 100.0
total 30 56 53.5


line stmt bran cond sub pod time code
1             package SVN::Access::Group;
2              
3 1     1   16 use 5.006001;
  1         3  
4 1     1   3 use strict;
  1         1  
  1         16  
5 1     1   12 use warnings;
  1         1  
  1         270  
6              
7             our $VERSION = '0.11';
8              
9             sub new {
10 24     24 1 51 my ($class, %attr) = @_;
11 24         44 return bless(\%attr, $class);
12             }
13              
14             sub members {
15 42     42 1 36 my ($self) = @_;
16 42         25 my @members;
17 42         29 foreach my $member (@{$self->{members}}) {
  42         55  
18 106         98 push(@members, $member);
19             }
20 42         135 return (@members);
21             }
22              
23             sub remove_member {
24 0     0 1 0 my ($self, $remove) = @_;
25 0         0 my @members;
26 0         0 foreach my $member (@{$self->{members}}) {
  0         0  
27 0 0       0 push(@members, $member) unless $member eq $remove;
28             }
29 0         0 $self->{members} = \@members;
30             }
31              
32             sub add_member {
33 0     0 1 0 my ($self, $new) = @_;
34 0 0       0 if ($self->member_exists($new)) {
35 0         0 return "Member $new already in group " . $self->name . "\n";
36             } else {
37 0         0 push(@{$self->{members}}, $new);
  0         0  
38 0         0 return "Member $new successfully added to group " . $self->name . "\n";
39             }
40             }
41              
42             sub member_exists {
43 0     0 1 0 my ($self, $search) = @_;
44 0         0 foreach my $member (@{$self->{members}}) {
  0         0  
45 0 0       0 return $member if $member eq $search;
46             }
47 0         0 return undef;
48             }
49              
50             sub name {
51 156     156 1 111 my ($self) = @_;
52 156         595 return $self->{name};
53             }
54              
55             1;
56             __END__