make xsubpp skip embedded pod (from Matthias Neeracher
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / xsubpp
index 4abdee9..30b264c 100755 (executable)
@@ -847,7 +847,14 @@ EOM
 print("#line 1 \"$filename\"\n")
     if $WantLineNumbers;
 
+firstmodule:
 while (<$FH>) {
+    if (/^=/) {
+       do {
+           next firstmodule if /^=cut\s*$/;
+       } while (<$FH>);
+       &Exit;
+    }
     last if ($Module, $Package, $Prefix) =
        /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/;
 
@@ -886,6 +893,16 @@ sub fetch_para {
     }
 
     for(;;) {
+       # Skip embedded PODs 
+       while ($lastline =~ /^=/) {
+           while ($lastline = <$FH>) {
+               last if ($lastline =~ /^=cut\s*$/);
+           }
+           death ("Error: Unterminated pod") unless $lastline;
+           $lastline = <$FH>;
+           chomp $lastline;
+           $lastline =~ s/^\s+$//;
+       }
        if ($lastline !~ /^\s*#/ ||
            # CPP directives:
            #   ANSI:   if ifdef ifndef elif else endif define undef
@@ -1562,7 +1579,6 @@ sub generate_init {
        unless defined($type_kind{$type});
 
     ($ntype = $type) =~ s/\s*\*/Ptr/g;
-    $ntype =~ s/^\s*const\b\s*//;
     ($subtype = $ntype) =~ s/(?:Array)?(?:Ptr)?$//;
     $tk = $type_kind{$type};
     $tk =~ s/OBJ$/REF/ if $func_name =~ /DESTROY$/;