diff options
author | Robin Houston <robin@cpan.org> | 2001-03-30 21:07:22 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-30 23:33:44 +0000 |
commit | e8d3f51b6cb9ed747b68e86c366260f31e4a1404 (patch) | |
tree | e87b0e5e4993885ff2bc55a765cbe64e3fe77cb6 /ext/B | |
parent | 0d2079faa739aaa999ddace336394cba070395f2 (diff) | |
download | perl-e8d3f51b6cb9ed747b68e86c366260f31e4a1404.tar.gz |
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
Diffstat (limited to 'ext/B')
-rw-r--r-- | ext/B/B/Deparse.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 5629c17607..32baa50f3d 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; } |