This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Expand tabs in diagnostics.pm
authorFather Chrysostomos <sprout@cpan.org>
Sat, 8 Feb 2014 21:22:01 +0000 (13:22 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 9 Feb 2014 01:34:25 +0000 (17:34 -0800)
Otherwise pod like this:

The second situation is caused by an eval accessing a lexical subroutine
that has gone out of scope, for example,

    sub f {
my sub a {...}
sub { eval '\&a' }
    }
    f()->();

is turned into this:

    The second situation is caused by an eval accessing a variable that has
    gone out of scope, for example,

        sub f {
     my $a;
     sub { eval '$a' }
        }
        f()->();

instead of this:

    The second situation is caused by an eval accessing a variable that has
    gone out of scope, for example,

        sub f {
            my $a;
            sub { eval '$a' }
        }
        f()->();

I don’t know how to test this without literally copying and pasting
parts of diagnostics.pm into diagnostics.t.  But I have tested it man-
ually and it works.

lib/diagnostics.pm

index a85f282..40c6748 100644 (file)
@@ -194,6 +194,7 @@ our $TRACEONLY = 0;
 our $WARNTRACE = 0;
 
 use Config;
+use Text::Tabs 'expand';
 my $privlib = $Config{privlibexp};
 if ($^O eq 'VMS') {
     require VMS::Filespec;
@@ -366,6 +367,7 @@ my %msg;
                {
                    next;
                }
+               $_ = expand $_;
                s/^/    /gm;
                $msg{$header} .= $_;
                for my $h(@headers) { $msg{$h} .= $_ }