Serialized/ACL/Group/File.pm

filter: Statementstmt 100% 39 / 39 Branchbran 91.6% 11 / 12 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 3 totaltotal 94.1% 64 / 68 CC 8 SCAR 11.0
CC
8
Cov
98%
is_member
5.0
new
4.0
BEGIN
1.0
CRAP 3.0
« Serialized/ACL/Group/GDBM_File.pm ↑ Summary Serialized/Server/UCSPI/TCP.pm »
1 #
2 # $HeadURL: https://svn.oucs.ox.ac.uk/people/oliver/pub/librpc-serialized-perl/trunk/lib/RPC/Serialized/ACL/Group/File.pm $
3 # $LastChangedRevision: 1281 $
4 # $LastChangedDate: 2008-10-01 16:16:56 +0100 (Wed, 01 Oct 2008) $
5 # $LastChangedBy: oliver $
6 #
7 package RPC::Serialized::ACL::Group::File;
8 {
9 2 $RPC::Serialized::ACL::Group::File::VERSION = '1.123630';
10 }
11  
12 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use base 'RPC::Serialized::ACL::Group';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use UNIVERSAL;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use RPC::Serialized::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 9 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
22 9 my $class = shift;
23 9 my $uri = shift;
24  
25 9 ▶ defined $uri and UNIVERSAL::isa( $uri, 'URI::file' )
Branch: 1 branch
BranchTrueFalseTotal
defined $uri and UNIVERSAL::isa($uri, "URI::file") or throw_app("Missing or invalid URI") 5 4 9
Condition100%3/3
defined $uri and UNIVERSAL::isa($uri, "URI::file")
!ll&&!rl&&r
135
MC/DC100%2/2
defined $uri and UNIVERSAL::isa($uri, "URI::file")
defined $uri UNIVERSAL::isa($uri, "URI::file")
Truth table100%3/3
A and B
A= defined $uriB= UNIVERSAL::isa($uri, "URI::file")
ABresult
0X0
100
111
26 or throw_app 'Missing or invalid URI';
27  
28 5 ▶ my $path = $uri->file
Branch: 1 branch
BranchTrueFalseTotal
my $path = $uri->file or throw_app(q[Can't determine path from URI ] . $uri->as_string) 4 1 5
29 or throw_app "Can't determine path from URI " . $uri->as_string;
30  
31 4 return bless {
32 PATH => $path,
33 }, $class;
34 }
35  
36 22 ▶sub path {
Subroutine path: called CC=1 SCAR=0.0
Pod undocumented
37 22 my $self = shift;
38 22 return $self->{PATH};
39 }
40  
41 20 ▶sub is_member {
Subroutine is_member: called CC=5 SCAR=16.1
Pod undocumented
42 20 my $self = shift;
43 20 my $name = shift;
44  
45 20 my $path = $self->path;
46 20 ▶ my $fh = IO::File->new( $path, O_RDONLY )
Branch: 1 branch
BranchTrueFalseTotal
my $fh = "IO::File"->new($path, 0) or throw_system("Failed to open ${path}: $!") 19 1 20
47 or throw_system "Failed to open $path: $!";
48  
49 19 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 42 4 46
50 42 s/#.*$//;
51 42 s/^\s+//;
52 42 s/\s+$//;
53 42 ▶ next unless length($_);
Branch: 1 branch
BranchTrueFalseTotal
unless length $_ 0 42 42
54 42 ▶ return 1 if $_ eq $name;
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $name 15 27 42
55 }
56  
57 4 return 0;
58 }
59  
60 2 1;
61  
« Serialized/ACL/Group/GDBM_File.pm ↑ Summary Serialized/Server/UCSPI/TCP.pm »