Debian Codegraph @

Symbols.PL

raw symbols SCIP
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 use File::Spec;
9
10 require XSLoader;
11 XSLoader::load('POSIX::2008', '0.28');
12
13 my %names;
14
15 foreach my $type (qw(constants functions)) {
16 $names{$type} = do {
17 local $/;
18 my $file = "${type}.txt";
19 open my $fh, '<', $file or die "Can't open $file: $!";
20 [sort split ' ', <$fh>];
21 };
22 }
23
24 my $file = File::Spec->catfile(
25 File::Spec->curdir(), qw(blib lib POSIX 2008 symbols.pl)
26 );
27
28 open my $fh, '>', $file or die "Can't open $file: $!";
29
30 foreach my $type (sort keys %names) {
31 print $fh "our \@_${type} = qw(\n";
32 foreach my $name (@{$names{$type}}) {
33 print $fh "$name\n" if defined &{"POSIX::2008::$name"};
34 }
35 print $fh ");\n\n";
36 }
37
38 print $fh "1;\n";
39 close $fh or die "Can't write $file: $!";