This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
deparse -wl0 -i.bak
[perl5.git] / ext / B / B / Deparse.pm
index 9eab37f..3789b81 100644 (file)
@@ -10,7 +10,7 @@ package B::Deparse;
 use Carp 'cluck', 'croak';
 use B qw(class main_root main_start main_cv svref_2object opnumber cstring
         OPf_WANT OPf_WANT_VOID OPf_WANT_SCALAR OPf_WANT_LIST
-        OPf_KIDS OPf_REF OPf_STACKED OPf_SPECIAL
+        OPf_KIDS OPf_REF OPf_STACKED OPf_SPECIAL OPf_MOD
         OPpLVAL_INTRO OPpOUR_INTRO OPpENTERSUB_AMPER OPpSLICE OPpCONST_BARE
         OPpTRANS_SQUASH OPpTRANS_DELETE OPpTRANS_COMPLEMENT OPpTARGET_MY
         OPpCONST_ARYBASE OPpEXISTS_SUB OPpSORT_NUMERIC OPpSORT_INTEGER
@@ -19,7 +19,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber cstring
          CVf_METHOD CVf_LOCKED CVf_LVALUE
         PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_SKIPWHITE
         PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED);
-$VERSION = 0.60;
+$VERSION = 0.62;
 use strict;
 use warnings ();
 
@@ -35,7 +35,7 @@ use warnings ();
 # - package declarations using cop_stash
 # - subs, formats and code sorted by cop_seq
 # Changes between 0.51 and 0.52:
-# - added pp_threadsv (special variables under USE_THREADS)
+# - added pp_threadsv (special variables under USE_5005THREADS)
 # - added documentation
 # Changes between 0.52 and 0.53:
 # - many changes adding precedence contexts and associativity
@@ -92,6 +92,19 @@ use warnings ();
 # - separate recognition of constant subs
 # - rewrote continue block handling, now recoginizing for loops
 # - added more control of expanding control structures
+# Changes between 0.60 and 0.61 (mostly by Robin Houston)
+# - many bug-fixes
+# - support for pragmas and 'use'
+# - support for the little-used $[ variable
+# - support for __DATA__ sections
+# - UTF8 support
+# - BEGIN, CHECK, INIT and END blocks
+# - scoping of subroutine declarations fixed
+# - compile-time output from the input program can be suppressed, so that the
+#   output is just the deparsed code. (a change to O.pm in fact)
+# - our() declarations
+# - *all* the known bugs are now listed in the BUGS section
+# - comprehensive test mechanism (TEST -deparse)
 
 # Todo:
 #  (See also BUGS section at the end of this file)
@@ -483,9 +496,15 @@ sub new {
     return $self;
 }
 
-sub WARN_MASK () {
-    # Mask out the bits that C<use vars> uses
-    $warnings::Bits{all} | $warnings::DeadBits{all};
+{
+    # Mask out the bits that L<warnings::register> uses
+    my $WARN_MASK;
+    BEGIN {
+       $WARN_MASK = $warnings::Bits{all} | $warnings::DeadBits{all};
+    }
+    sub WARN_MASK () {
+       return $WARN_MASK;
+    }
 }
 
 # Initialise the contextual information, either from
@@ -508,6 +527,18 @@ sub compile {
     my(@args) = @_;
     return sub { 
        my $self = B::Deparse->new(@args);
+       # First deparse command-line args
+       if (defined $^I) { # deparse -i
+           print q(BEGIN { $^I = ).cstring($^I).qq(; }\n);
+       }
+       if ($^W) { # deparse -w
+           print qq(BEGIN { \$^W = $^W; }\n);
+       }
+       if ($/ ne "\n" or defined $O::savebackslash) { # deparse -l and -0
+           my $fs = cstring($/) || 'undef';
+           my $bs = cstring($O::savebackslash) || 'undef';
+           print qq(BEGIN { \$/ = $fs; \$\\ = $bs; }\n);
+       }
        my @BEGINs  = B::begin_av->isa("B::AV") ? B::begin_av->ARRAY : ();
        my @INITs   = B::init_av->isa("B::AV") ? B::init_av->ARRAY : ();
        my @ENDs    = B::end_av->isa("B::AV") ? B::end_av->ARRAY : ();
@@ -594,13 +625,13 @@ sub ambient_pragmas {
        elsif ($name eq 're') {
            require re;
            if ($val eq 'none') {
-               $hint_bits &= ~re::bits(qw/taint eval asciirange/);
+               $hint_bits &= ~re::bits(qw/taint eval/);
                next();
            }
 
            my @names;
            if ($val eq 'all') {
-               @names = qw/taint eval asciirange/;
+               @names = qw/taint eval/;
            }
            elsif (ref $val) {
                @names = @$val;
@@ -613,7 +644,7 @@ sub ambient_pragmas {
 
        elsif ($name eq 'warnings') {
            if ($val eq 'none') {
-               $warning_bits = "\0"x12;
+               $warning_bits = $warnings::NONE;
                next();
            }
 
@@ -625,7 +656,7 @@ sub ambient_pragmas {
                @names = split/\s+/, $val;
            }
 
-           $warning_bits = "\0"x12 if !defined ($warning_bits);
+           $warning_bits = $warnings::NONE if !defined ($warning_bits);
            $warning_bits |= warnings::bits(@names);
        }
 
@@ -749,10 +780,12 @@ sub deparse_format {
     my @text;
     local($self->{'curcv'}) = $form;
     local($self->{'curcvlex'});
+    local($self->{'in_format'}) = 1;
     local(@$self{qw'curstash warnings hints'})
-               = @$self{'curstash warnings hints'};
+               = @$self{qw'curstash warnings hints'};
     my $op = $form->ROOT;
     my $kid;
+    return "\f." if $op->first->name eq 'stub';
     $op = $op->first->first; # skip leavewrite, lineseq
     while (not null $op) {
        $op = $op->sibling; # skip nextstate
@@ -961,6 +994,11 @@ sub pp_mapstart { # see also mapwhile
     return "XXX";
 }
 
+sub pp_method_named {
+    cluck "unexpected OP_METHOD_NAMED";
+    return "XXX";
+}
+
 sub pp_flip { # see also flop
     cluck "unexpected OP_FLIP";
     return "XXX";
@@ -1040,7 +1078,7 @@ sub lineseq {
     }
     my $body = join(";\n", grep {length} @exprs);
     my $subs = "";
-    if (defined $root && defined $limit_seq) {
+    if (defined $root && defined $limit_seq && !$self->{'in_format'}) {
        $subs = join "\n", $self->seq_subs($limit_seq);
     }
     return join(";\n", grep {length} $body, $subs);
@@ -1252,10 +1290,10 @@ sub pp_nextstate {
     my $warnings = $op->warnings;
     my $warning_bits;
     if ($warnings->isa("B::SPECIAL") && $$warnings == 4) {
-       $warning_bits = $warnings::Bits{"all"};
+       $warning_bits = $warnings::Bits{"all"} & WARN_MASK;
     }
     elsif ($warnings->isa("B::SPECIAL") && $$warnings == 5) {
-        $warning_bits = "\0"x12;
+        $warning_bits = $warnings::NONE;
     }
     elsif ($warnings->isa("B::SPECIAL")) {
        $warning_bits = undef;
@@ -1820,7 +1858,8 @@ sub binop {
        ($left, $right) = ($right, $left);
     }
     $left = $self->deparse_binop_left($op, $left, $prec);
-    $left = "($left)" if $flags & LIST_CONTEXT && $left =~ /^\$/;
+    $left = "($left)" if $flags & LIST_CONTEXT
+               && $left !~ /^(my|our|local|)[\@\(]/;
     $right = $self->deparse_binop_right($op, $right, $prec);
     return $self->maybe_parens("$left $opname$eq $right", $cx, $prec);
 }
@@ -2423,6 +2462,8 @@ sub pp_leavetry {
 
 BEGIN { eval "sub OP_CONST () {" . opnumber("const") . "}" }
 BEGIN { eval "sub OP_STRINGIFY () {" . opnumber("stringify") . "}" }
+BEGIN { eval "sub OP_RV2SV () {" . opnumber("rv2sv") . "}" }
+BEGIN { eval "sub OP_LIST () {" . opnumber("list") . "}" }
 
 sub pp_null {
     my $self = shift;
@@ -2531,6 +2572,11 @@ sub pp_aelemfast {
 sub rv2x {
     my $self = shift;
     my($op, $cx, $type) = @_;
+
+    if (class($op) eq 'NULL' || !$op->can("first")) {
+       Carp::cluck("Unexpected op in pp_rv2x");
+       return 'XXX';
+    }
     my $kid = $op->first;
     my $str = $self->deparse($kid, 0);
     return $self->stash_variable($type, $str) if is_scalar($kid);
@@ -2554,7 +2600,17 @@ sub pp_av2arylen {
 }
 
 # skip down to the old, ex-rv2cv
-sub pp_rv2cv { $_[0]->rv2x($_[1]->first->first->sibling, $_[2], "&") }
+sub pp_rv2cv {
+    my ($self, $op, $cx) = @_;
+    if (!null($op->first) && $op->first->name eq 'null' &&
+       $op->first->targ eq OP_LIST)
+    {
+       return $self->rv2x($op->first->first->sibling, $cx, "&")
+    }
+    else {
+       return $self->rv2x($op, $cx, "")
+    }
+}
 
 sub pp_rv2av {
     my $self = shift;
@@ -2633,6 +2689,16 @@ sub elem {
     #
     $idx =~ s/^\((.*)\)$/$1/ if $self->{'parens'};
 
+    # Hash-element braces will autoquote a bareword inside themselves.
+    # We need to make sure that C<$hash{warn()}> doesn't come out as
+    # C<$hash{warn}>, which has a quite different meaning. Currently
+    # B::Deparse will always quote strings, even if the string was a
+    # bareword in the original (i.e. the OPpCONST_BARE flag is ignored
+    # for constant strings.) So we can cheat slightly here - if we see
+    # a bareword, we know that it is supposed to be a function call.
+    #
+    $idx =~ s/^([A-Za-z_]\w*)$/$1()/;
+
     return "\$" . $array . $left . $idx . $right;
 }
 
@@ -2736,7 +2802,8 @@ sub method {
     } else {
        $obj = $kid;
        $kid = $kid->sibling;
-       for (; not null $kid->sibling; $kid = $kid->sibling) {
+       for (; !null ($kid->sibling) && $kid->name ne "method_named";
+             $kid = $kid->sibling) {
            push @exprs, $self->deparse($kid, 6);
        }
        $meth = $kid;
@@ -2756,7 +2823,7 @@ sub method {
     }
     my $args = join(", ", @exprs);     
     $kid = $obj . "->" . $meth;
-    if ($args) {
+    if (length $args) {
        return $kid . "(" . $args . ")"; # parens mandatory
     } else {
        return $kid;
@@ -2846,7 +2913,7 @@ sub pp_entersub {
     my $prefix = "";
     my $amper = "";
     my($kid, @exprs);
-    if ($op->flags & OPf_SPECIAL) {
+    if ($op->flags & OPf_SPECIAL && !($op->flags & OPf_MOD)) {
        $prefix = "do ";
     } elsif ($op->private & OPpENTERSUB_AMPER) {
        $amper = "&";
@@ -2868,7 +2935,7 @@ sub pp_entersub {
        }
        $simple = 1; # only calls of named functions can be prototyped
        $kid = $self->deparse($kid, 24);
-    } elsif (is_scalar $kid->first) {
+    } elsif (is_scalar ($kid->first) && $kid->first->name ne 'rv2cv') {
        $amper = "&";
        $kid = $self->deparse($kid, 24);
     } else {
@@ -2902,7 +2969,7 @@ sub pp_entersub {
        }
     } else {
        # glob() invocations can be translated into calls of
-       # CORE::GLOBAL::glob with an second parameter, a number.
+       # CORE::GLOBAL::glob with a second parameter, a number.
        # Reverse this.
        if ($kid eq "CORE::GLOBAL::glob") {
            $kid = "glob";
@@ -2938,13 +3005,12 @@ sub uninterp {
     return $str;
 }
 
-# the same, but treat $|, $), $( and $ at the end of the string differently
-sub re_uninterp {
-    my($str) = @_;
-
+{
+my $bal;
+BEGIN {
     use re "eval";
     # Matches any string which is balanced with respect to {braces}
-    my $bal = qr(
+    $bal = qr(
       (?:
        [^\\{}]
       | \\\\
@@ -2952,6 +3018,11 @@ sub re_uninterp {
       | \{(??{$bal})\}
       )*
     )x;
+}
+
+# the same, but treat $|, $), $( and $ at the end of the string differently
+sub re_uninterp {
+    my($str) = @_;
 
     $str =~ s/
          ( ^|\G                  # $1
@@ -2974,6 +3045,35 @@ sub re_uninterp {
     return $str;
 }
 
+# This is for regular expressions with the /x modifier
+# We have to leave comments unmangled.
+sub re_uninterp_extended {
+    my($str) = @_;
+
+    $str =~ s/
+         ( ^|\G                  # $1
+          | [^\\]
+          )
+
+          (                       # $2
+            (?:\\\\)*
+          )
+
+          (                       # $3
+            ( \(\?\??\{$bal\}\)   # $4  (skip over (?{}) and (??{}) blocks)
+            | \#[^\n]*            #     (skip over comments)
+            )
+          | [\$\@]
+            (?!\||\)|\(|$)
+          | \\[uUlLQE]
+          )
+
+       /length($4) ? "$1$2$4" : "$1$2\\$3"/xeg;
+
+    return $str;
+}
+}
+
 # character escapes, but not delimiters that might need to be escaped
 sub escape_str { # ASCII, UTF8
     my($str) = @_;
@@ -2990,6 +3090,16 @@ sub escape_str { # ASCII, UTF8
     return $str;
 }
 
+# For regexes with the /x modifier.
+# Leave whitespace unmangled.
+sub escape_extended_re {
+    my($str) = @_;
+    $str =~ s/(.)/ord($1)>255 ? sprintf("\\x{%x}", ord($1)) : $1/eg;
+    $str =~ s/([\0\033-\037\177-\377])/'\\' . sprintf("%03o", ord($1))/ge;
+    $str =~ s/\n/\n\f/g;
+    return $str;
+}
+
 # Don't do this for regexen
 sub unback {
     my($str) = @_;
@@ -3059,7 +3169,13 @@ sub const {
     } elsif ($sv->FLAGS & SVf_IOK) {
        return $sv->int_value;
     } elsif ($sv->FLAGS & SVf_NOK) {
-       return $sv->NV;
+       # try the default stringification
+       my $r = "".$sv->NV;
+       if ($r =~ /e/) {
+           # If it's in scientific notation, we might have lost information
+           return sprintf("%.20e", $sv->NV);
+       }
+       return $r;
     } elsif ($sv->FLAGS & SVf_ROK && $sv->can("RV")) {
        return "\\(" . const($sv->RV) . ")"; # constant folded
     } elsif ($sv->FLAGS & SVf_POK) {
@@ -3108,13 +3224,13 @@ sub dq {
     } elsif ($type eq "concat") {
        my $first = $self->dq($op->first);
        my $last  = $self->dq($op->last);
+
        # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]"
-       if ($last =~ /^[A-Z\\\^\[\]_?]/) {
-           $first =~ s/([\$@])\^$/${1}{^}/;  # "${^}W" etc
-        }
-       elsif ($last =~ /^[{\[\w]/) {
-           $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/;
-       }
+       ($last =~ /^[A-Z\\\^\[\]_?]/ &&
+           $first =~ s/([\$@])\^$/${1}{^}/)  # "${^}W" etc
+           || ($last =~ /^[{\[\w_]/ &&
+               $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/);
+
        return $first . $last;
     } elsif ($type eq "uc") {
        return '\U' . $self->dq($op->first->sibling) . '\E';
@@ -3232,7 +3348,7 @@ sub collapse {
 sub tr_decode_byte {
     my($table, $flags) = @_;
     my(@table) = unpack("s*", $table);
-    splice @table, 0x100, 1;   # Just flags presence of element 0x101
+    splice @table, 0x100, 1;   # Number of subsequent elements
     my($c, $tr, @from, @to, @delfrom, $delhyphen);
     if ($table[ord "-"] != -1 and 
        $table[ord("-") - 1] == -1 || $table[ord("-") + 1] == -1)
@@ -3402,32 +3518,36 @@ sub pp_trans {
 # Like dq(), but different
 sub re_dq {
     my $self = shift;
-    my $op = shift;
+    my ($op, $extended) = @_;
+
     my $type = $op->name;
     if ($type eq "const") {
        return '$[' if $op->private & OPpCONST_ARYBASE;
-       return re_uninterp(escape_str(re_unback($self->const_sv($op)->as_string)));
+       my $unbacked = re_unback($self->const_sv($op)->as_string);
+       return re_uninterp_extended(escape_extended_re($unbacked))
+           if $extended;
+       return re_uninterp(escape_str($unbacked));
     } elsif ($type eq "concat") {
-       my $first = $self->re_dq($op->first);
-       my $last  = $self->re_dq($op->last);
+       my $first = $self->re_dq($op->first, $extended);
+       my $last  = $self->re_dq($op->last,  $extended);
+
        # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]"
-       if ($last =~ /^[A-Z\\\^\[\]_?]/) {
-           $first =~ s/([\$@])\^$/${1}{^}/;
-       }
-       elsif ($last =~ /^[{\[\w]/) {
-           $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/;
-       }
+       ($last =~ /^[A-Z\\\^\[\]_?]/ &&
+           $first =~ s/([\$@])\^$/${1}{^}/)  # "${^}W" etc
+           || ($last =~ /^[{\[\w_]/ &&
+               $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/);
+
        return $first . $last;
     } elsif ($type eq "uc") {
-       return '\U' . $self->re_dq($op->first->sibling) . '\E';
+       return '\U' . $self->re_dq($op->first->sibling, $extended) . '\E';
     } elsif ($type eq "lc") {
-       return '\L' . $self->re_dq($op->first->sibling) . '\E';
+       return '\L' . $self->re_dq($op->first->sibling, $extended) . '\E';
     } elsif ($type eq "ucfirst") {
-       return '\u' . $self->re_dq($op->first->sibling);
+       return '\u' . $self->re_dq($op->first->sibling, $extended);
     } elsif ($type eq "lcfirst") {
-       return '\l' . $self->re_dq($op->first->sibling);
+       return '\l' . $self->re_dq($op->first->sibling, $extended);
     } elsif ($type eq "quotemeta") {
-       return '\Q' . $self->re_dq($op->first->sibling) . '\E';
+       return '\Q' . $self->re_dq($op->first->sibling, $extended) . '\E';
     } elsif ($type eq "join") {
        return $self->deparse($op->last, 26); # was join($", @ary)
     } else {
@@ -3435,13 +3555,54 @@ sub re_dq {
     }
 }
 
-sub pp_regcomp {
+sub pure_string {
+    my ($self, $op) = @_;
+    my $type = $op->name;
+
+    if ($type eq 'const') {
+       return 1;
+    }
+    elsif ($type =~ /^[ul]c(first)?$/ || $type eq 'quotemeta') {
+       return $self->pure_string($op->first->sibling);
+    }
+    elsif ($type eq 'join') {
+       my $join_op = $op->first->sibling;  # Skip pushmark
+       return 0 unless $join_op->name eq 'null' && $join_op->targ eq OP_RV2SV;
+
+       my $gvop = $join_op->first;
+       return 0 unless $gvop->name eq 'gvsv';
+        return 0 unless '"' eq $self->gv_name($self->gv_or_padgv($gvop));
+
+       return 0 unless ${$join_op->sibling} eq ${$op->last};
+       return 0 unless $op->last->name =~ /^(rv2|pad)av$/;
+    }
+    elsif ($type eq 'concat') {
+       return $self->pure_string($op->first)
+            && $self->pure_string($op->last);
+    }
+    elsif (is_scalar($op) || $type =~ /^[ah]elem(fast)?$/) {
+       return 1;
+    }
+    else {
+       return 0;
+    }
+
+    return 1;
+}
+
+sub regcomp {
     my $self = shift;
-    my($op, $cx) = @_;
+    my($op, $cx, $extended) = @_;
     my $kid = $op->first;
     $kid = $kid->first if $kid->name eq "regcmaybe";
     $kid = $kid->first if $kid->name eq "regcreset";
-    return $self->re_dq($kid);
+    return ($self->re_dq($kid, $extended), 1) if $self->pure_string($kid);
+    return ($self->deparse($kid, $cx), 0);
+}
+
+sub pp_regcomp {
+    my ($self, $op, $cx) = @_;
+    return (($self->regcomp($op, $cx, 0))[0]);
 }
 
 # osmic acid -- see osmium tetroxide
@@ -3461,11 +3622,19 @@ sub matchop {
        $var = $self->deparse($kid, 20);
        $kid = $kid->sibling;
     }
+    my $quote = 1;
+    my $extended = ($op->pmflags & PMf_EXTENDED);
     if (null $kid) {
-       $re = re_unback($op->precomp);
-       $re = re_uninterp(escape_str($re)) unless $op->pmflags & PMf_EXTENDED;
+       my $unbacked = re_unback($op->precomp);
+       if ($extended) {
+           $re = re_uninterp_extended(escape_extended_re($unbacked));
+       } else {
+           $re = re_uninterp(escape_str(re_unback($op->precomp)));
+       }
+    } elsif ($kid->name ne 'regcomp') {
+       Carp::cluck("found ".$kid->name." where regcomp expected");
     } else {
-       $re = $self->deparse($kid, 1);
+       ($re, $quote) = $self->regcomp($kid, 1, $extended);
     }
     my $flags = "";
     $flags .= "c" if $op->pmflags & PMf_CONTINUE;
@@ -3479,10 +3648,10 @@ sub matchop {
     if ($op->pmflags & PMf_ONCE) { # only one kind of delimiter works here
        $re =~ s/\?/\\?/g;
        $re = "?$re?";
-    } else {
+    } elsif ($quote) {
        $re = single_delim($name, $delim, $re);
     }
-    $re = $re . $flags;
+    $re = $re . $flags if $quote;
     if ($binop) {
        return $self->maybe_parens("$var =~ $re", $cx, 20);
     } else {
@@ -3558,10 +3727,17 @@ sub pp_subst {
            $repl = $self->dq($repl);   
        }
     }
+    my $extended = ($op->pmflags & PMf_EXTENDED);
     if (null $kid) {
-       $re = re_uninterp(escape_str(re_unback($op->precomp)));
+       my $unbacked = re_unback($op->precomp);
+       if ($extended) {
+           $re = re_uninterp_extended(escape_extended_re($unbacked));
+       }
+       else {
+           $re = re_uninterp(escape_str($unbacked));
+       }
     } else {
-       $re = $self->deparse($kid, 1);
+       ($re) = $self->regcomp($kid, 1, $extended);
     }
     $flags .= "e" if $op->pmflags & PMf_EVAL;
     $flags .= "g" if $op->pmflags & PMf_GLOBAL;
@@ -3569,7 +3745,7 @@ sub pp_subst {
     $flags .= "m" if $op->pmflags & PMf_MULTILINE;
     $flags .= "o" if $op->pmflags & PMf_KEEP;
     $flags .= "s" if $op->pmflags & PMf_SINGLELINE;
-    $flags .= "x" if $op->pmflags & PMf_EXTENDED;
+    $flags .= "x" if $extended;
     $flags = $substwords{$flags} if $substwords{$flags};
     if ($binop) {
        return $self->maybe_parens("$var =~ s"
@@ -3967,32 +4143,22 @@ than in the input file.
 
 =item *
 
-Lvalue method calls are not yet fully supported. (Ordinary lvalue
-subroutine calls ought to be okay though.)
+In fact, the above is a specific instance of a more general problem:
+we can't guarantee to produce BEGIN blocks or C<use> declarations in
+exactly the right place. So if you use a module which affects compilation
+(such as by over-riding keywords, overloading constants or whatever)
+then the output code might not work as intended.
 
-=item *
-
-If you have a regex which is anything other than a literal of some
-kind, B::Deparse will produce incorrect output.
-e.g. C<$foo =~ give_me_a_regex()> will come back as
-C<$foo =~ /give_me_a_regex()/>
-
-=item *
-
-  m{ #foo
-      bar }x
-
-comes out as
-
-  m/#foo\n    bar/x)
-
-which isn't right.
+This is the most serious outstanding problem, and will be very hard
+to fix.
 
 =item *
 
 If a keyword is over-ridden, and your program explicitly calls
 the built-in version by using CORE::keyword, the output of B::Deparse
-will not reflect this.
+will not reflect this. If you run the resulting code, it will call
+the over-ridden version rather than the built-in one. (Maybe there
+should be an option to B<always> print keyword calls as C<CORE::name>.)
 
 =item *
 
@@ -4007,11 +4173,16 @@ The obvious fix doesn't work, because these are different:
 =item *
 
 Constants (other than simple strings or numbers) don't work properly.
-Examples that fail include:
+Pathological examples that fail (and probably always will) include:
 
     use constant E2BIG => ($!=7);
     use constant x=>\$x; print x
 
+The following could (and should) be made to work:
+
+    use constant regex => qr/blah/;
+    print regex;
+
 =item *
 
 An input file that uses source filtering probably won't be deparsed into