blib/lib/POSIX/1003/Errno.pm

filter: Statementstmt 89.1% 33 / 37 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 10 / 12 Podpod 100% 4 / 4 totaltotal 76.4% 52 / 68 CC 7 SCAR 12.3
CC
7
Cov
78%
exampleValue
12.0
errno
3.0
strerror
2.1
CRAP 3.4
« blib/lib/POSIX/SigAction.pm ↑ Summary blib/lib/POSIX/1003/Events.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::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
BranchTrueFalseTotal
$name =~ /^(?:WSA)?E/ or return 0 0 0
44 0 ▶ errno($name) // 'undef';
Condition0%0/2
&errno($name) // "undef"
l!l
00
MC/DC0%0/1
&errno($name) // "undef"
&errno($name)
Truth table0%0/2
A
A= &errno($name)
Aresult
11
00
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
BranchTrueFalseTotal
&_strerror($_[0]) or "Unknown error $_[0]" 0 134 134
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)
l!l
1370
MC/DC0%0/1
shift() // (return)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
53 137 ▶ $key =~ /^(?:WSA)?E/
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /^(?:WSA)?E/ or croak("pass the constant name $key as string") 135 2 137
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 } )
l!l
80
MC/DC0%0/1
$errno->{$name} // (return sub () { undef } )
$errno->{$name}
Truth table50%1/2
A
A= $errno->{$name}
Aresult
11
00
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;
« blib/lib/POSIX/SigAction.pm ↑ Summary blib/lib/POSIX/1003/Events.pm »