Reorder the SV flags so that SVp_?OK and SVf_?OK occupy 8 contiguous
[p5sagit/p5-mst-13.2.git] / pod / splitpod
index 0e93633..d5963bf 100755 (executable)
@@ -5,20 +5,26 @@ use Pod::Functions;
 
 local $/ = '';
 
+$level = 0;
+
 $cur = '';
 while (<>) {
 
     next unless /^=(?!cut)/ .. /^=cut/;
 
-    if (/=item (\S+)/ and $1 ne '*') {
+    ++$level if /^=over/;
+    --$level if /^=back/;
+
+    # Ignore items that are nested within other items, e.g. don't split on the
+    # items nested within the pack() and sprintf() items in perlfunc.pod.
+    if (/=item (\S+)/ and $level == 1) {
+       my $item = $1;
        s/=item //; 
-       #$cur = "POSIX::" . $1;
-       $next{$cur} = $1;
-       $cur = $1;
+       $next{$cur} = $item;
+       $cur = $item;
        $syn{$cur} .= $_;
        next;
     } else { 
-       #s,L</,L<POSIX/,g;
        s,L</,L<perlfunc/,g;
        push @{$pod{$cur}}, $_ if $cur;
     }