| 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::Confstr; | ||||||||||||
| 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/confstr confstr_names/; | |||||||||||
| 22 | |||||||||||||
| 23 | 5 | our %EXPORT_TAGS = | |||||||||||
| 24 | ( constants => \@constants | ||||||||||||
| 25 | , functions => \@functions | ||||||||||||
| 26 | , tables => [ '%confstr' ] | ||||||||||||
| 27 | ); | ||||||||||||
| 28 | |||||||||||||
| 29 | sub confstr($); | ||||||||||||
| 30 | 5 | my $confstr; | |||||||||||
| 31 | 5 | our %confstr; | |||||||||||
| 32 | |||||||||||||
| 33 | 5 | ▶ | BEGIN { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 34 | 5 | $confstr = confstr_table; | |||||||||||
| 35 | 5 | push @constants, keys %$confstr; | |||||||||||
| 36 | 5 | tie %confstr, 'POSIX::1003::ReadOnlyTable', $confstr; | |||||||||||
| 37 | } | ||||||||||||
| 38 | |||||||||||||
| 39 | |||||||||||||
| 40 | sub exampleValue($) | ||||||||||||
| 41 | 0 | ▶ | { my ($class, $name) = @_; | ||||||||||
|
Subroutine
exampleValue: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 42 | 0 | ▶ | $name =~ m/^_CS_/ or return; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | 0 | my $val = confstr $name; | |||||||||||
| 44 | 0 | ▶ | defined $val ? "'$val'" : 'undef'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | #----------------------- | ||||||||||||
| 48 | |||||||||||||
| 49 | sub confstr($) | ||||||||||||
| 50 | 68 | ▶ | { my $key = shift // return; | ||||||||||
|
Subroutine
confstr: called CC=4 SCAR=14.2
Pod
documented
Condition50%1/2
shift() // (return)
MC/DC0%0/1
shift() // (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 51 | 68 | ▶ | $key =~ /^_CS_/ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | or croak "pass the constant name as string"; | ||||||||||||
| 53 | |||||||||||||
| 54 | 66 | ▶ | my $id = $confstr->{$key} // return; | ||||||||||
|
Condition50%1/2
$confstr->{$key} // (return)
MC/DC0%0/1
$confstr->{$key} // (return)
$confstr->{$key}
Truth table50%1/2
A
A= $confstr->{$key}
| |||||||||||||
| 55 | 66 | _confstr($id); | |||||||||||
| 56 | } | ||||||||||||
| 57 | |||||||||||||
| 58 | sub _create_constant($) | ||||||||||||
| 59 | 1 | ▶ | { my ($class, $name) = @_; | ||||||||||
|
Subroutine
_create_constant: called CC=2 SCAR=7.0
| |||||||||||||
| 60 | 1 | ▶ | my $id = $confstr->{$name} // return sub() {undef}; | ||||||||||
|
Condition50%1/2
$confstr->{$name} // (return sub () { undef }
)
MC/DC0%0/1
$confstr->{$name} // (return sub () { undef }
)
$confstr->{$name}
Truth table50%1/2
A
A= $confstr->{$name}
| |||||||||||||
| 61 | 1 | ▶ | sub() {_confstr($id)}; | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 62 | } | ||||||||||||
| 63 | |||||||||||||
| 64 | #-------------------------- | ||||||||||||
| 65 | |||||||||||||
| 66 | 1 | ▶ | sub confstr_names() { keys %$confstr } | ||||||||||
|
Subroutine
confstr_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 67 | |||||||||||||
| 68 | #-------------------------- | ||||||||||||
| 69 | |||||||||||||
| 70 | 5 | 1; | |||||||||||