This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta up to e38acfd7
[perl5.git] / minimod.pl
index 377ee8b..a5bd172 100644 (file)
@@ -1,5 +1,5 @@
 #./miniperl -w
-# minimod.PL writes the contents of miniperlmain.c into the module
+# minimod.pl writes the contents of miniperlmain.c into the module
 # ExtUtils::Miniperl for later perusal (when the perl source is
 # deleted)
 #
@@ -11,6 +11,8 @@
 #
 # Version 1.0, Feb 2nd 1995 by Andreas Koenig
 
+BEGIN { unshift @INC, "lib" }
+
 use strict;
 
 print <<'END';
@@ -35,6 +37,7 @@ open MINI, "miniperlmain.c";
 while (<MINI>) {
     last if /Do not delete this line--writemain depends on it/;
     print;
+    /#include "perl.h"/ and print qq/#include "XSUB.h"\n/;
 }
 
 print <<'END';
@@ -65,11 +68,12 @@ sub writemain{
         print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n";
     }
 
-    my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
-    print $tail1;
+    my ($tail1,$tail2,$tail3) = ( $tail =~ /\A(.*{\s*\n)(.*\n)(\s*\}.*)\Z/s );
 
+    print $tail1;
     print "\tconst char file[] = __FILE__;\n";
     print "\tdXSUB_SYS;\n" if $] > 5.002;
+    print $tail2;
 
     foreach $_ (@exts){
        my($pname) = canon('/', $_);
@@ -89,7 +93,7 @@ sub writemain{
        }
        print "\t}\n";
     }
-    print $tail2;
+    print $tail3;
 }
 
 sub canon{