blib/lib/POSIX/1003/Properties.pm

filter: Statementstmt 86.4% 32 / 37 Branchbran 16.6% 1 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 81.8% 9 / 11 Podpod 100% 3 / 3 totaltotal 76.6% 46 / 60 CC 5 SCAR 13.0
CC
5
Cov
76%
exampleValue
12.0
property
3.2
__ANON__
1.1
CRAP 3.7
« blib/lib/POSIX/1003/Confstr.pm ↑ Summary blib/lib/POSIX/1003/FdIO.pm »
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::Properties;
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/property property_names/;
22  
23 5 our %EXPORT_TAGS =
24 ( constants => \@constants
25 , functions => \@functions
26 , tables => [ '%property' ]
27 );
28  
29 5 my $property;
30 5 our %property;
31  
32 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
33 5 $property = property_table;
34 5 push @constants, keys %$property;
35 5 tie %property, 'POSIX::1003::ReadOnlyTable', $property;
36 }
37  
38 sub property($);
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/^_POSIX/ or return;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^_POSIX/ or return 0 0 0
44 0 my $val = property $name;
45 0 ▶ defined $val ? $val : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 0 0 0
46 }
47  
48  
49 sub property($)
50 104 ▶{ my $key = shift // return;
Subroutine property: called CC=3 SCAR=11.7
Pod documented
Condition50%1/2
shift() // (return)
l!l
1040
MC/DC0%0/1
shift() // (return)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
51 104 ▶ $key =~ /^_POSIX/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^_POSIX/ or croak("pass the constant name as string") 104 0 104
52 or croak "pass the constant name as string";
53  
54 104 $property->{$key};
55 }
56  
57 sub _create_constant($)
58 1 ▶{ my ($class, $name) = @_;
Subroutine _create_constant: called CC=1 SCAR=0.2
59 1 my $value = $property->{$name};
60 0 ▶ sub() {$value};
Subroutine __ANON__: not called CC=1 SCAR=1.2
61 }
62  
63  
64 1 ▶sub property_names() { keys %$property }
Subroutine property_names: called CC=1 SCAR=0.0
Pod documented
65  
66  
67 5 1;
« blib/lib/POSIX/1003/Confstr.pm ↑ Summary blib/lib/POSIX/1003/FdIO.pm »