RE: [PATCH] -I and MakeMaker again
[p5sagit/p5-mst-13.2.git] / lib / diagnostics.pm
index 8c7aedc..4ef9a2f 100755 (executable)
@@ -44,7 +44,7 @@ These still go out B<STDERR>.
 Due to the interaction between runtime and compiletime issues,
 and because it's probably not a very good idea anyway,
 you may not use C<no diagnostics> to turn them off at compiletime.
-However, you may control there behaviour at runtime using the 
+However, you may control their behaviour at runtime using the 
 disable() and enable() methods to turn them off and on respectively.
 
 The B<-verbose> flag first prints out the L<perldiag> introduction before
@@ -168,10 +168,10 @@ Tom Christiansen <F<tchrist@mox.perl.com>>, 25 June 1995.
 =cut
 
 use strict;
-use 5.005_64;
+use 5.6.0;
 use Carp;
 
-our $VERSION = v1.0;
+our $VERSION = 1.0;
 our $DEBUG;
 our $VERBOSE;
 our $PRETTY;
@@ -195,6 +195,12 @@ my @trypod = (
 unshift @trypod, "./pod/perldiag.pod" if -e "pod/perldiag.pod";
 (my $PODFILE) = ((grep { -e } @trypod), $trypod[$#trypod])[0];
 
+if ($^O eq 'MacOS') {
+    # just updir one from each lib dir, we'll find it ...
+    ($PODFILE) = grep { -e } map { "$_:pod:perldiag.pod" } @INC;
+}
+
+
 $DEBUG ||= 0;
 my $WHOAMI = ref bless [];  # nobody's business, prolly not even mine
 
@@ -343,9 +349,16 @@ my %msg;
            next;
        }
 
+       if( $for_item ) { $header = $for_item; undef $for_item } 
+       else {
+           $header = $1;
+           while( $header =~ /[;,]\z/ ) {
+               <POD_DIAG> =~ /^\s*(.*?)\s*\z/;
+               $header .= ' '.$1;
+           }
+       }
+
        # strip formatting directives in =item line
-       $header = $for_item || $1;
-       undef $for_item;        
        $header =~ s/[A-Z]<(.*?)>/$1/g;
 
        if ($header =~ /%[csd]/) {
@@ -432,8 +445,8 @@ sub enable { &import }
 sub disable {
     shift;
     return unless $SIG{__WARN__} eq \&warn_trap;
-    $SIG{__WARN__} = $oldwarn;
-    $SIG{__DIE__} = $olddie;
+    $SIG{__WARN__} = $oldwarn || '';
+    $SIG{__DIE__} = $olddie || '';
 } 
 
 sub warn_trap {