blib/lib/POSIX/1003/Pathconf.pm

filter: Statementstmt 88.8% 40 / 45 Branchbran 50.0% 7 / 14 Conditioncond 44.4% 4 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 84.6% 11 / 13 Podpod 100% 4 / 4 totaltotal 73.3% 66 / 90 CC 12 SCAR 14.2
CC
12
Cov
75%
exampleValue
12.0
fpathconf
6.1
pathconf
4.1
CRAP 4.1
« blib/lib/POSIX/1003/FS.pm ↑ Summary lists.PL »
1 # Copyrights 2011-2020 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.02.
5 # This code is part of distribution POSIX-1003. Meta-POD processed with
6 # OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package POSIX::1003::Pathconf;
10 5 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 $VERSION = '1.02';
12  
13 5 ▶use base 'POSIX::1003::Module';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 5 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 5 my @constants;
21 5 my @functions = qw/pathconf fpathconf pathconf_names/;
22  
23 5 our %EXPORT_TAGS =
24 ( constants => \@constants
25 , functions => \@functions
26 , tables => [ '%pathconf' ]
27 );
28  
29 5 my $pathconf;
30 5 our %pathconf;
31  
32 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
33 5 $pathconf = pathconf_table;
34 5 push @constants, keys %$pathconf;
35 5 tie %pathconf, 'POSIX::1003::ReadOnlyTable', $pathconf;
36 }
37  
38 sub pathconf($$);
39  
40  
41 sub exampleValue($)
42 0 ▶{ my ($class, $name) = @_;
Subroutine exampleValue: not called CC=3 SCAR=24.8
Pod documented
43 0 ▶ $name =~ m/^_PC_/ or return;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^_PC_/ or return 0 0 0
44 0 my $val = pathconf __FILE__, $name;
45 0 ▶ defined $val ? $val : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 0 0 0
46 }
47  
48  
49 sub fpathconf($$)
50 1 ▶{ my ($fd, $key) = @_;
Subroutine fpathconf: called CC=5 SCAR=18.1
Pod documented
51 1 ▶ $key =~ /^_PC_/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^_PC_/ or croak("pass the constant name as string") 1 0 1
52 or croak "pass the constant name as string";
53 1 ▶ my $id = $pathconf{$key} // return;
Condition50%1/2
$POSIX::1003::Pathconf::pathconf{$key} // (return)
l!l
10
MC/DC0%0/1
$POSIX::1003::Pathconf::pathconf{$key} // (return)
$POSIX::1003::Pathconf::pathconf{$key}
Truth table50%1/2
A
A= $POSIX::1003::Pathconf::pathconf{$key}
Aresult
11
00
54 1 my $v = POSIX::fpathconf($fd, $id);
55 1 ▶ defined $v && $v eq '0 but true' ? 0 : $v;
Branch: 1 branch
BranchTrueFalseTotal
defined $v && $v eq '0 but true' ? : 0 1 1
Condition33%1/3
defined $v and $v eq "0 but true"
!ll&&!rl&&r
010
MC/DC0%0/2
defined $v and $v eq "0 but true"
defined $v $v eq "0 but true"
Truth table33%1/3
A and B
A= defined $vB= $v eq "0 but true"
ABresult
0X0
100
111
56 }
57  
58 sub pathconf($$)
59 22 ▶{ my ($fn, $key) = @_;
Subroutine pathconf: called CC=4 SCAR=14.1
Pod documented
60 22 ▶ $key =~ /^_PC_/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^_PC_/ or croak("pass the constant name as string") 22 0 22
61 or croak "pass the constant name as string";
62 22 ▶ my $id = $pathconf{$key} // return;
Condition50%1/2
$POSIX::1003::Pathconf::pathconf{$key} // (return)
l!l
220
MC/DC0%0/1
$POSIX::1003::Pathconf::pathconf{$key} // (return)
$POSIX::1003::Pathconf::pathconf{$key}
Truth table50%1/2
A
A= $POSIX::1003::Pathconf::pathconf{$key}
Aresult
11
00
63 22 my $v = POSIX::pathconf($fn, $id);
64 22 ▶ defined $v ? $v+0 : undef; # remove 'but true' from '0'
Branch: 1 branch
BranchTrueFalseTotal
defined $v ? : 16 6 22
65 }
66  
67 sub _create_constant($)
68 1 ▶{ my ($class, $name) = @_;
Subroutine _create_constant: called CC=2 SCAR=7.1
69 0 ▶ my $id = $pathconf->{$name} // return sub($) {undef};
Subroutine __ANON__: not called CC=1 SCAR=1.2
Condition50%1/2
$pathconf->{$name} // (return sub ($) { undef; } )
l!l
10
MC/DC0%0/1
$pathconf->{$name} // (return sub ($) { undef; } )
$pathconf->{$name}
Truth table50%1/2
A
A= $pathconf->{$name}
Aresult
11
00
70 2 ▶ sub($) { my $f = shift;
Subroutine __ANON__: called CC=2 SCAR=6.9
71 2 ▶ $f =~ m/\D/
Branch: 1 branch
BranchTrueFalseTotal
$f =~ /\D/ ? : 1 1 2
72 ? POSIX::pathconf($f, $id)
73 : POSIX::fpathconf($f, $id)
74 1 };
75 }
76  
77  
78 1 ▶sub pathconf_names() { keys %$pathconf }
Subroutine pathconf_names: called CC=1 SCAR=0.0
Pod documented
79  
« blib/lib/POSIX/1003/FS.pm ↑ Summary lists.PL »