Defined-or patch (cleaned up)
[p5sagit/p5-mst-13.2.git] / ext / B / B / Deparse.pm
index 786c7a4..c985896 100644 (file)
@@ -586,7 +586,7 @@ sub compile {
 sub coderef2text {
     my $self = shift;
     my $sub = shift;
-    croak "Usage: ->coderef2text(CODEREF)" unless ref($sub) eq "CODE";
+    croak "Usage: ->coderef2text(CODEREF)" unless UNIVERSAL::isa($sub, "CODE");
 
     $self->init();
     return $self->indent($self->deparse_sub(svref_2object($sub)));
@@ -1951,6 +1951,7 @@ sub logop {
 
 sub pp_and { logop(@_, "and", 3, "&&", 11, "if") }
 sub pp_or  { logop(@_, "or",  2, "||", 10, "unless") }
+sub pp_dor { logop(@_, "err", 2, "//", 10, "") }
 
 # xor is syntactically a logop, but it's really a binop (contrary to
 # old versions of opcode.pl). Syntax is what matters here.
@@ -1967,7 +1968,8 @@ sub logassignop {
 }
 
 sub pp_andassign { logassignop(@_, "&&=") }
-sub pp_orassign { logassignop(@_, "||=") }
+sub pp_orassign  { logassignop(@_, "||=") }
+sub pp_dorassign { logassignop(@_, "//=") }
 
 sub listop {
     my $self = shift;
@@ -2951,14 +2953,6 @@ sub pp_entersub {
        # it back.
        $kid =~ s/^CORE::GLOBAL:://;
 
-        # If the sub name is not a valid identifier, then somebody
-        # (probably Abigail) must have written "foo"->(...). Reproduce
-        # this.
-        if ($kid !~ /^([a-zA-Z_]|::)([a-zA-Z_0-9]|::)*$/) {
-            $kid = single_delim("qq", '"', uninterp(escape_str(unback($kid))));
-            $kid .= "->";
-        }
-
         if (!$declared) {
            return "$kid(" . $args . ")";
        } elsif (defined $proto and $proto eq "") {