4 @ARGV = qw( constants );
7 my %gen = map { ($_ => 1) } @ARGV;
9 if (delete $gen{constants}) {
13 for my $key (keys %gen) {
14 print STDERR "Invalid request to regenerate $key!\n";
19 unless (eval { require ExtUtils::Constant; 1 }) {
20 my @files = qw( const-c.inc const-xs.inc );
22 die "Cannot regenerate constants:\n$@\n" if grep { !-f } @files;
24 my @deps = qw( regen.pl lib/IPC/SysV.pm );
26 my $oldage = (sort { $a <=> $b } map { -M } @files)[-1]; # age of oldest file
27 my $depage = (sort { $a <=> $b } map { -M } @deps)[0]; # age of newest dependency
28 my @outdated = grep { (-M) > $depage } @files;
29 my @newdeps = grep { (-M) < $oldage } @deps;
33 ***********************************************************************
35 The following files seem to be out of date:
39 The reason is probably that you modified these files:
43 If you're absolutely sure you didn't touch the files, please ignore
46 Otherwise, please install the ExtUtils::Constant module.
48 ***********************************************************************
52 exit 0; # will build anyway, since the files exist
55 my $source = 'lib/IPC/SysV.pm';
59 open SYSV, $source or die "$source: $!\n";
66 if (/^\)/) { $parse++; last }
69 /^\@EXPORT_OK\s*=/ and $parse++;
74 die "couldn't parse $source" if $parse != 2;
77 ExtUtils::Constant::WriteConstants(
80 XS_FILE => 'const-xs.inc',
81 C_FILE => 'const-c.inc',
82 XS_SUBNAME => '_constant',
87 my $err = "Cannot regenerate constants:\n$@\n";
95 print "Writing const-xs.inc\n";
96 print "Writing const-c.inc\n";