| 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::Errno; | ||||||||||||
| 10 | 8 | ▶ | use vars '$VERSION'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 8 | $VERSION = '1.02'; | |||||||||||
| 12 | |||||||||||||
| 13 | 8 | ▶ | use base 'POSIX::1003::Module'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | 8 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 8 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | 8 | ▶ | use Carp 'croak'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | |||||||||||||
| 20 | 8 | my @constants; | |||||||||||
| 21 | 8 | my @functions = qw/strerror errno errno_names/; | |||||||||||
| 22 | |||||||||||||
| 23 | 8 | our %EXPORT_TAGS = | |||||||||||
| 24 | ( constants => \@constants | ||||||||||||
| 25 | , functions => \@functions | ||||||||||||
| 26 | , tables => [ '%errno' ] | ||||||||||||
| 27 | ); | ||||||||||||
| 28 | |||||||||||||
| 29 | 8 | my $errno; | |||||||||||
| 30 | 8 | our %errno; | |||||||||||
| 31 | |||||||||||||
| 32 | 8 | ▶ | BEGIN { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 33 | 8 | $errno = errno_table; | |||||||||||
| 34 | 8 | push @constants, keys %$errno; | |||||||||||
| 35 | 8 | tie %errno, 'POSIX::1003::ReadOnlyTable', $errno; | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | sub errno($); | ||||||||||||
| 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/^(?:WSA)?E/ or return; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | ▶ | errno($name) // 'undef'; | ||||||||||
|
Condition0%0/2
&errno($name) // "undef"
MC/DC0%0/1
&errno($name) // "undef"
&errno($name)
Truth table0%0/2
A
A= &errno($name)
| |||||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | |||||||||||||
| 48 | 134 | ▶ | sub strerror($) { _strerror($_[0]) || "Unknown error $_[0]" } | ||||||||||
|
Subroutine
strerror: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||||
| 49 | |||||||||||||
| 50 | |||||||||||||
| 51 | sub errno($) | ||||||||||||
| 52 | 137 | ▶ | { my $key = shift // return; | ||||||||||
|
Subroutine
errno: called CC=3 SCAR=11.1
Pod
documented
Condition50%1/2
shift() // (return)
MC/DC0%0/1
shift() // (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 53 | 137 | ▶ | $key =~ /^(?:WSA)?E/ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 54 | or croak "pass the constant name $key as string"; | ||||||||||||
| 55 | |||||||||||||
| 56 | 135 | $errno->{$key}; | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | sub _create_constant($) | ||||||||||||
| 60 | 8 | ▶ | { my ($class, $name) = @_; | ||||||||||
|
Subroutine
_create_constant: called CC=2 SCAR=7.6
| |||||||||||||
| 61 | 8 | ▶ | my $nr = $errno->{$name} // return sub() {undef}; | ||||||||||
|
Condition50%1/2
$errno->{$name} // (return sub () { undef }
)
MC/DC0%0/1
$errno->{$name} // (return sub () { undef }
)
$errno->{$name}
Truth table50%1/2
A
A= $errno->{$name}
| |||||||||||||
| 62 | 0 | ▶ | sub() {$nr}; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | |||||||||||||
| 66 | 1 | ▶ | sub errno_names() { keys %$errno } | ||||||||||
|
Subroutine
errno_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 67 | |||||||||||||
| 68 | |||||||||||||
| 69 | 8 | 1; | |||||||||||