Change 18114 by rgs@rgs-home on 2002/11/06 20:08:53 Subject: Re: [PATCH] [perl #18175] B::Concise,-exec doesn't handle // operator well From: Stephen McCamant <[EMAIL PROTECTED]> Date: Thu, 31 Oct 2002 01:35:29 -0500 Message-ID: <[EMAIL PROTECTED]> plus a test case in ext/B/t/concise.t plus a (less intrusive, but less future-proof) fix for a similar problem in B::walkoptree_exec().
Affected files ... .... //depot/perl/ext/B/B.pm#48 edit .... //depot/perl/ext/B/B/Concise.pm#15 edit .... //depot/perl/ext/B/t/concise.t#3 edit Differences ... ==== //depot/perl/ext/B/B.pm#48 (text) ==== Index: perl/ext/B/B.pm --- perl/ext/B/B.pm#47~17804~ Thu Aug 29 06:29:43 2002 +++ perl/ext/B/B.pm Wed Nov 6 12:08:53 2002 @@ -176,7 +176,7 @@ $op->$method($level); $ppname = $op->name; if ($ppname =~ - /^(or|and|mapwhile|grepwhile|entertry|range|cond_expr)$/) + +/^(d?or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/) { print $prefix, uc($1), " => {\n"; walkoptree_exec($op->other, $method, $level + 1); ==== //depot/perl/ext/B/B/Concise.pm#15 (text) ==== Index: perl/ext/B/B/Concise.pm --- perl/ext/B/B/Concise.pm#14~17725~ Fri Aug 16 17:51:19 2002 +++ perl/ext/B/B/Concise.pm Wed Nov 6 12:08:53 2002 @@ -1,5 +1,5 @@ package B::Concise; -# Copyright (C) 2000, 2001 Stephen McCamant. All rights reserved. +# Copyright (C) 2000-2002 Stephen McCamant. All rights reserved. # This program is free software; you can redistribute and/or modify it # under the same terms as Perl itself. @@ -234,8 +234,7 @@ last if $opsseen{$$op}++; push @$targ, $op; my $name = $op->name; - if ($name - =~ /^(or|and|(map|grep)while|entertry|range|cond_expr)$/) { + if (class($op) eq "LOGOP") { my $ar = []; push @$targ, $ar; push @todo, [$op->other, $ar]; ==== //depot/perl/ext/B/t/concise.t#3 (text) ==== Index: perl/ext/B/t/concise.t --- perl/ext/B/t/concise.t#2~14215~ Sat Jan 12 07:22:01 2002 +++ perl/ext/B/t/concise.t Wed Nov 6 12:08:53 2002 @@ -6,7 +6,7 @@ require './test.pl'; } -plan tests => 4; +plan tests => 5; require_ok("B::Concise"); @@ -24,3 +24,13 @@ is($op_base_p1, 2, "Second-smallest OP sequence number"); is($cop_base, 1, "Smallest COP sequence number"); + +# test that with -exec B::Concise navigates past logops (bug #18175) + +$out = runperl( + switches => ["-MO=Concise,-exec"], + prog => q{$a//=$b && print q/foo/}, + stderr => 1, +); + +like($out, qr/"foo"/, "-exec option with //="); End of Patch.