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