The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!perl -w
use strict;

my $debug = shift || 0;
open(PPERL, ">pperl.h") || die "Can't write to pperl.h: $!";
open(PPERL_HEAD, "<pperl.h.header") || die "Can't read pperl.h.header: $!";



print PPERL <<'EOT';
/* pperl.h - autogenerated from pperl.h.header by write_pperl_h */

#define perl_header ""\
EOT

sub spool {
    while (<PPERL_HEAD>) {
        last if /#### Your Code Here ####/;
        s/^\s*log_error.*// # lose log_error calls
          unless $debug;
        s/\\/\\\\/g; # double up all backslashes
        s/"/\\"/g; # backslash all quotes
        s/^(.*)$/"$1\\n"\\/; # wrap in quotes
        print PPERL $_;
    }
}

spool();

print PPERL << 'EOT';
"\n"

#define perl_footer ""\
EOT

spool();

print PPERL << 'EOT';
"\n"

EOT

my $version = `grep 'VERSION =' PPerl.pm | cut -d"'" -f2`;
chomp($version); 
print PPERL '#define PPERL_VERSION "'. "$version\"\n";
close PPERL;
close PPERL_HEAD;