Fix deparsing of require "a".$1
authorFather Chrysostomos <sprout@cpan.org>
Mon, 19 Dec 2011 04:48:40 +0000 (20:48 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 19 Dec 2011 04:48:40 +0000 (20:48 -0800)
Commit 30fcd6c41 tried to deparse ‘no 6’ correctly by checking
whether the kidop of a require has the OPpCONST_NOVER flag set,
but it did not check the op type, so it ended up with a false
positive for any binop (OPpCONST_NOVER being 2).

dist/B-Deparse/Deparse.pm
dist/B-Deparse/t/deparse.t

index 977ce4d..3ca229d 100644 (file)
@@ -1889,7 +1889,10 @@ sub pp_require {
     } else {   
        $self->unop(
            $op, $cx,
-           $op->first->private & OPpCONST_NOVER ? "no" : $opname,
+           $op->first->name eq 'const'
+            && $op->first->private & OPpCONST_NOVER
+                ? "no"
+                : $opname,
            1, # llafr does not apply
        );
     }
index 2c3efd5..22f2cb5 100644 (file)
@@ -893,3 +893,6 @@ pipe local *FH, local *FH;
 ####
 # [perl #74740] -(f()) vs -f()
 $_ = -(f());
+####
+# require <binop>
+require 'a' . $1;