1#!./perl -l 2 3# There's a bug in -P where the #! line is ignored. If this test 4# suddenly starts printing blank lines that bug has been fixed. 5 6print "1..3\n"; 7 8#define MESS "ok 1\n" 9print MESS; 10 11#ifdef MESS 12 print "ok 2\n"; 13#else 14 print "not ok 2\n"; 15#endif 16 17open(TRY,">Comp_cpp.tmp") || die "Can't open temp perl file: $!"; 18 19($prog = <<'END') =~ s/X//g; 20X$ok = "not ok 3\n"; 21X#include "Comp_cpp.inc" 22X#ifdef OK 23X$ok = OK; 24X#endif 25Xprint $ok; 26END 27print TRY $prog; 28close TRY or die "Could not close Comp_cpp.tmp: $!"; 29 30open(TRY,">Comp_cpp.inc") || (die "Can't open temp include file: $!"); 31print TRY '#define OK "ok 3\n"' . "\n"; 32close TRY or die "Could not close Comp_cpp.tmp: $!"; 33 34print `$^X "-P" Comp_cpp.tmp`; 35unlink "Comp_cpp.tmp", "Comp_cpp.inc"; 36