diff options
author | Jan Dubois <jand@activestate.com> | 2006-05-25 11:20:25 -0700 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2006-05-27 15:05:30 +0000 |
commit | e89a6d4ec25220634f772b600b8e9c56f45d9de2 (patch) | |
tree | 0df039892bf6a2cf92d789da7798d5a50ce7fc1c /pod/perlhack.pod | |
parent | 21612876029045d9a1c77c4382f26aba4c269fb2 (diff) | |
download | perl-e89a6d4ec25220634f772b600b8e9c56f45d9de2.tar.gz |
RE: perlhack.pod confused about POPSTACK
From: "Jan Dubois" <jand@activestate.com>
Message-Id: <059101c68062$9143d550$2217a8c0@candy>
more fixing of the PUSHMARK example
p4raw-id: //depot/perl@28317
Diffstat (limited to 'pod/perlhack.pod')
-rw-r--r-- | pod/perlhack.pod | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/pod/perlhack.pod b/pod/perlhack.pod index fc3c68638f..43e76ac129 100644 --- a/pod/perlhack.pod +++ b/pod/perlhack.pod @@ -1356,10 +1356,6 @@ roughly how the tied C<push> is implemented; see C<av_push> in F<av.c>: 7 call_method("PUSH", G_SCALAR|G_DISCARD); 8 LEAVE; -The lines which concern the mark stack are the first, fifth and last -lines: they save away, restore and remove the current position of the -argument stack. - Let's examine the whole implementation, for practice: 1 PUSHMARK(SP); @@ -1379,8 +1375,8 @@ retrieved with C<SvTIED_obj>, and the value, the SV C<val>. 5 PUTBACK; -Next we tell Perl to make the change to the global stack pointer: C<dSP> -only gave us a local copy, not a reference to the global. +Next we tell Perl to update the global stack pointer from our internal +variable: C<dSP> only gave us a local copy, not a reference to the global. 6 ENTER; 7 call_method("PUSH", G_SCALAR|G_DISCARD); @@ -1394,7 +1390,9 @@ C<}> of a Perl block. To actually do the magic method call, we have to call a subroutine in Perl space: C<call_method> takes care of that, and it's described in L<perlcall>. We call the C<PUSH> method in scalar context, and we're -going to discard its return value. +going to discard its return value. The call_method() function +removes the top element of the mark stack, so there is nothing for +the caller to clean up. =item Save stack |