| 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
Condition100%3/3
defined $uri and UNIVERSAL::isa($uri, "URI::file")
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")
| |||||||||||||||||||||||||||||
| 26 | or throw_app 'Missing or invalid URI'; | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 5 | ▶ | my $path = $uri->file | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 47 | or throw_system "Failed to open $path: $!"; | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 19 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 42 | s/#.*$//; | |||||||||||||||||||||||||||
| 51 | 42 | s/^\s+//; | |||||||||||||||||||||||||||
| 52 | 42 | s/\s+$//; | |||||||||||||||||||||||||||
| 53 | 42 | ▶ | next unless length($_); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 42 | ▶ | return 1 if $_ eq $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 4 | return 0; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 2 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||