diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-01 05:45:10 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-01 05:45:10 +0000 |
commit | 6cb9131c3c45484b20cdd0fbdd8c19fda70c73a8 (patch) | |
tree | 4cfb7c29171c8bb75195a984cdd9675e9c8e5a58 | |
parent | d9aad7f7caf6c1d42b8e71a2a04bfca6447d2827 (diff) | |
download | perl-6cb9131c3c45484b20cdd0fbdd8c19fda70c73a8.tar.gz |
better documentation for goto &NAME (from M. J. T. Guy)
p4raw-id: //depot/perl@4607
-rw-r--r-- | pod/perlfunc.pod | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 3497ca9bdf..16da798a02 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1929,13 +1929,20 @@ necessarily recommended if you're optimizing for maintainability: goto ("FOO", "BAR", "GLARCH")[$i]; -The C<goto-&NAME> form is highly magical, and substitutes a call to the -named subroutine for the currently running subroutine. This is used by -C<AUTOLOAD> subroutines that wish to load another subroutine and then -pretend that the other subroutine had been called in the first place -(except that any modifications to C<@_> in the current subroutine are -propagated to the other subroutine.) After the C<goto>, not even C<caller> -will be able to tell that this routine was called first. +The C<goto-&NAME> form is quite different from the other forms of C<goto>. +In fact, it isn't a goto in the normal sense at all, and doesn't have +the stigma associated with other gotos. Instead, it +substitutes a call to the named subroutine for the currently running +subroutine. This is used by C<AUTOLOAD> subroutines that wish to load +another subroutine and then pretend that the other subroutine had been +called in the first place (except that any modifications to C<@_> +in the current subroutine are propagated to the other subroutine.) +After the C<goto>, not even C<caller> will be able to tell that this +routine was called first. + +NAME needn't be the name of a subroutine; it can be a scalar variable +containing a code reference, or a block which evaluates to a code +reference. =item grep BLOCK LIST |