From: Robin Houston Date: Fri, 30 Mar 2001 20:07:22 +0000 (+0100) Subject: Re: [ID 20010330.003] O=Deparse,-p does not preserve "operational semantics" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e8d3f51b6cb9ed747b68e86c366260f31e4a1404;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20010330.003] O=Deparse,-p does not preserve "operational semantics" Message-ID: <20010330200722.A2010@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9482 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 5629c17..32baa50 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -573,7 +573,11 @@ sub maybe_local { my $self = shift; my($op, $cx, $text) = @_; if ($op->private & OPpLVAL_INTRO and not $self->{'avoid_local'}{$$op}) { - return $self->maybe_parens_func("local", $text, $cx, 16); + if (want_scalar($op)) { + return "local $text"; + } else { + return $self->maybe_parens_func("local", $text, $cx, 16); + } } else { return $text; } @@ -601,7 +605,11 @@ sub maybe_my { my $self = shift; my($op, $cx, $text) = @_; if ($op->private & OPpLVAL_INTRO and not $self->{'avoid_local'}{$$op}) { - return $self->maybe_parens_func("my", $text, $cx, 16); + if (want_scalar($op)) { + return "my $text"; + } else { + return $self->maybe_parens_func("my", $text, $cx, 16); + } } else { return $text; }