Symbols.PL

filter: Statementstmt 100% 25 / 25 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 91.6% 33 / 36 CC 1 SCAR 0.0
CC
1
Cov
91%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« const-xs.inc ↑ Summary blib/lib/POSIX/2008/symbols.pl »
1 # This script is automatically executed after 2008.xs has been compiled. It
2 # takes all symbol names from constants.txt and functions.txt that we would
3 # like to provide, checks which of them we actually provide, and makes these
4 # available through @_constants and @_functions in symbols.pl which is loaded
5 # by 2008.pm via "require" to populate @EXPORT_OK. This is to make sure that
6 # "use POSIX::2008 'non_existent_name';" croaks at compile time.
7  
8 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use XSLoader ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 XSLoader::load('POSIX::2008', '0.30');
12 }
13  
14 1 my %names;
15  
16 1 foreach my $type (qw(constants functions)) {
17 2 $names{$type} = do {
18 2 local $/;
19 2 my $file = "${type}.txt";
20 2 ▶ open my $fh, '<', $file or die "Can't open $file: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $file or die "Can't open ${file}: $!" 2 0 2
21 2 [sort split ' ', <$fh>];
22 };
23 }
24  
25 1 my $file = File::Spec->catfile(
26 File::Spec->curdir(), qw(blib lib POSIX 2008 symbols.pl)
27 );
28  
29 1 ▶open my $fh, '>', $file or die "Can't open $file: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $file or die "Can't open ${file}: $!" 1 0 1
30  
31 1 foreach my $type (sort keys %names) {
32 2 print $fh "our \@_${type} = qw(\n";
33 2 foreach my $name (@{$names{$type}}) {
34 1130 ▶ print $fh "$name\n" if defined &{"POSIX::2008::$name"};
Branch: 1 branch
BranchTrueFalseTotal
if defined &{"POSIX::2008::$name";} 994 136 1130
35 }
36 2 print $fh ");\n\n";
37 }
38  
39 1 print $fh "1;\n";
40 1 ▶close $fh or die "Can't write $file: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die "Can't write ${file}: $!" 1 0 1
« const-xs.inc ↑ Summary blib/lib/POSIX/2008/symbols.pl »