blib/lib/POSIX/1003/Sysconf.pm

filter: Statementstmt 64.1% 25 / 39 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 54.5% 6 / 11 Podpod 100% 3 / 3 totaltotal 47.8% 34 / 71 CC 8 SCAR 24.5
CC
8
Cov
47%
sysconf
30.0
exampleValue
12.0
_create_constant
6.0
CRAP 11.6
« blib/lib/POSIX/1003/Pathconf.pm ↑ Summary blib/lib/POSIX/1003/FdIO.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::Sysconf;
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/sysconf sysconf_names/;
18  
19 1 our %EXPORT_TAGS =
20 ( constants => \@constants
21 , functions => \@functions
22 , tables => [ '%sysconf' ]
23 );
24  
25 1 my $sysconf;
26 1 our %sysconf;
27  
28 BEGIN {
29 # initialize the :constants export tag
30 1 ▶ $sysconf = sysconf_table;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 push @constants, keys %$sysconf;
32 1 tie %sysconf, 'POSIX::1003::ReadOnlyTable', $sysconf;
33 }
34  
35 sub sysconf($);
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/^_SC_/ or return;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^_SC_/ or return 0 0 0
41 0 my $val = sysconf $name;
42 0 ▶ defined $val ? $val : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 0 0 0
43 }
44  
45  
46 sub sysconf($)
47 0 ▶{ my $key = shift // return;
Subroutine sysconf: not called CC=5 SCAR=34.0
Pod documented
Condition0%0/2
shift() // (return)
l!l
00
MC/DC0%0/1
shift() // (return)
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
48 0 ▶ $key =~ /^_SC_/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^_SC_/ or croak("pass the constant name as string") 0 0 0
49 or croak "pass the constant name as string";
50
51 0 ▶ my $id = $sysconf->{$key} // return;
Condition0%0/2
$sysconf->{$key} // (return)
l!l
00
MC/DC0%0/1
$sysconf->{$key} // (return)
$sysconf->{$key}
Truth table0%0/2
A
A= $sysconf->{$key}
Aresult
11
00
52 0 ▶ my $val = POSIX::sysconf($id) // return;
Condition0%0/2
POSIX::sysconf($id) // (return)
l!l
00
MC/DC0%0/1
POSIX::sysconf($id) // (return)
POSIX::sysconf($id)
Truth table0%0/2
A
A= POSIX::sysconf($id)
Aresult
11
00
53 0 $val+0; # remove " but true" from "0"
54 }
55  
56 sub _create_constant($)
57 0 ▶{ my ($class, $name) = @_;
Subroutine _create_constant: not called CC=2 SCAR=17.9
58 0 ▶ my $id = $sysconf->{$name} // return sub() {undef};
Condition0%0/2
$sysconf->{$name} // (return sub () { undef } )
l!l
00
MC/DC0%0/1
$sysconf->{$name} // (return sub () { undef } )
$sysconf->{$name}
Truth table0%0/2
A
A= $sysconf->{$name}
Aresult
11
00
59 0 ▶ sub() {POSIX::sysconf($id)};
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 }
61  
62  
63 0 ▶sub sysconf_names() { keys %$sysconf }
Subroutine sysconf_names: not called CC=1 SCAR=6.9
Pod documented
64  
65  
66 1 1;
« blib/lib/POSIX/1003/Pathconf.pm ↑ Summary blib/lib/POSIX/1003/FdIO.pm »