Add entry for prototype() in Pod::Functions
[p5sagit/p5-mst-13.2.git] / lib / AutoSplit.pm
index cc9de33..f7b8eee 100644 (file)
@@ -149,7 +149,10 @@ sub autosplit_file{
 
     # where to write output files
     $autodir = "lib/auto" unless $autodir;
-    ($autodir = VMS::Filespec::unixpath($autodir)) =~ s#/$## if $Is_VMS;
+    if ($Is_VMS) {
+       ($autodir = VMS::Filespec::unixpath($autodir)) =~ s{/$}{};
+       $filename = VMS::Filespec::unixify($filename); # may have dirs
+    }
     unless (-d $autodir){
        local($", @p)="/";
        foreach(split(/\//,$autodir)){
@@ -248,7 +251,10 @@ sub autosplit_file{
 
     open(OUT,">/dev/null") || open(OUT,">nla0:"); # avoid 'not opened' warning
     my(@subnames, %proto);
+    my @cache = ();
+    my $caching = 1;
     while (<IN>) {
+       next if /^=\w/ .. /^=cut/;
        if (/^package ([\w:]+)\s*;/) {
            warn "package $1; in AutoSplit section ignored. Not currently supported.";
        }
@@ -275,10 +281,26 @@ sub autosplit_file{
            print OUT "# NOTE: Derived from $filename.  ",
                        "Changes made here will be lost.\n";
            print OUT "package $package;\n\n";
+           print OUT @cache;
+           @cache = ();
+           $caching = 0;
+       }
+       if($caching) {
+           push(@cache, $_) if @cache || /\S/;
+       }
+       else {
+           print OUT $_;
+       }
+       if(/^}/) {
+           if($caching) {
+               print OUT @cache;
+               @cache = ();
+           }
+           print OUT "\n";
+           $caching = 1;
        }
-       print OUT $_;
     }
-    print OUT "1;\n";
+    print OUT @cache,"1;\n";
     close(OUT);
     close(IN);