blib/lib/POSIX/1003/Pathconf.pm

filter: Statementstmt 53.3% 24 / 45 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 46.1% 6 / 13 Podpod 100% 4 / 4 totaltotal 37.7% 34 / 90 CC 12 SCAR 25.3
CC
12
Cov
35%
fpathconf
30.0
pathconf
20.0
exampleValue
12.0
CRAP 12.5
« blib/lib/POSIX/1003/Time.pm ↑ Summary blib/lib/POSIX/1003/Sysconf.pm »
1 # Copyrights 2011-2013 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.01.
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 package POSIX::1003::Pathconf;
9 3 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 $VERSION = '0.98';
11  
12 3 ▶use base 'POSIX::1003::Module';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 my @constants;
17 1 my @functions = qw/pathconf fpathconf pathconf_names/;
18  
19 1 our %EXPORT_TAGS =
20 ( constants => \@constants
21 , functions => \@functions
22 , tables => [ '%pathconf' ]
23 );
24  
25 1 my $pathconf;
26 1 our %pathconf;
27  
28 BEGIN {
29 # initialize the :constants export tag
30 1 ▶ $pathconf = pathconf_table;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 push @constants, keys %$pathconf;
32 1 tie %pathconf, 'POSIX::1003::ReadOnlyTable', $pathconf;
33 }
34  
35 sub pathconf($$);
36  
37  
38 sub exampleValue($)
39 0 ▶{ my ($class, $name) = @_;
Subroutine exampleValue: not called CC=3 SCAR=24.8
Pod documented
40 0 ▶ $name =~ m/^_PC_/ or return;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^_PC_/ or return 0 0 0
41 0 my $val = pathconf __FILE__, $name;
42 0 ▶ defined $val ? $val : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 0 0 0
43 }
44  
45  
46 sub fpathconf($$)
47 0 ▶{ my ($fd, $key) = @_;
Subroutine fpathconf: not called CC=5 SCAR=34.0
Pod documented
48 0 ▶ $key =~ /^_PC_/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^_PC_/ or croak("pass the constant name as string") 0 0 0
49 or croak "pass the constant name as string";
50 0 ▶ my $id = $pathconf{$key} // return;
Condition0%0/2
$POSIX::1003::Pathconf::pathconf{$key} // (return)
l!l
00
MC/DC0%0/1
$POSIX::1003::Pathconf::pathconf{$key} // (return)
$POSIX::1003::Pathconf::pathconf{$key}
Truth table0%0/2
A
A= $POSIX::1003::Pathconf::pathconf{$key}
Aresult
11
00
51 0 my $v = POSIX::fpathconf($fd, $id);
52 0 ▶ defined $v && $v eq '0 but true' ? 0 : $v;
Branch: 1 branch
BranchTrueFalseTotal
defined $v && $v eq '0 but true' ? : 0 0 0
Condition0%0/3
defined $v and $v eq "0 but true"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $v and $v eq "0 but true"
defined $v $v eq "0 but true"
Truth table0%0/3
A and B
A= defined $vB= $v eq "0 but true"
ABresult
0X0
100
111
53 }
54  
55 sub pathconf($$)
56 0 ▶{ my ($fn, $key) = @_;
Subroutine pathconf: not called CC=4 SCAR=30.0
Pod documented
57 0 ▶ $key =~ /^_PC_/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^_PC_/ or croak("pass the constant name as string") 0 0 0
58 or croak "pass the constant name as string";
59 0 ▶ my $id = $pathconf{$key} // return;
Condition0%0/2
$POSIX::1003::Pathconf::pathconf{$key} // (return)
l!l
00
MC/DC0%0/1
$POSIX::1003::Pathconf::pathconf{$key} // (return)
$POSIX::1003::Pathconf::pathconf{$key}
Truth table0%0/2
A
A= $POSIX::1003::Pathconf::pathconf{$key}
Aresult
11
00
60 0 my $v = POSIX::pathconf($fn, $id);
61 0 ▶ defined $v ? $v+0 : undef; # remove 'but true' from '0'
Branch: 1 branch
BranchTrueFalseTotal
defined $v ? : 0 0 0
62 }
63  
64 sub _create_constant($)
65 0 ▶{ my ($class, $name) = @_;
Subroutine _create_constant: not called CC=2 SCAR=17.9
66 0 ▶ my $id = $pathconf->{$name} // return sub($) {undef};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/2
$pathconf->{$name} // (return sub ($) { undef; } )
l!l
00
MC/DC0%0/1
$pathconf->{$name} // (return sub ($) { undef; } )
$pathconf->{$name}
Truth table0%0/2
A
A= $pathconf->{$name}
Aresult
11
00
67 0 ▶ sub($) { my $f = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
68 0 ▶ $f =~ m/\D/
Branch: 1 branch
BranchTrueFalseTotal
$f =~ /\D/ ? : 0 0 0
69 ? POSIX::pathconf($f, $id)
70 : POSIX::fpathconf($f, $id)
71 0 };
72 }
73  
74  
75 0 ▶sub pathconf_names() { keys %$pathconf }
Subroutine pathconf_names: not called CC=1 SCAR=6.9
Pod documented
76  
« blib/lib/POSIX/1003/Time.pm ↑ Summary blib/lib/POSIX/1003/Sysconf.pm »