diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-10-11 23:02:41 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-11 23:04:29 -0700 |
commit | 5b36e9450efc47317616775e6c3eb0daba56035c (patch) | |
tree | cd7cbc7aa620f5d5e5ce5aebcc8e1796581ad876 /pod/perlguts.pod | |
parent | bb619f370aef1336c90dc1522addf0eff4dfd6c6 (diff) | |
download | perl-5b36e9450efc47317616775e6c3eb0daba56035c.tar.gz |
Improve documentation of XS autoloading
Diffstat (limited to 'pod/perlguts.pod')
-rw-r--r-- | pod/perlguts.pod | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 38ed3e1926..97b97589e1 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -1498,6 +1498,26 @@ C<m(X)PUSH[iunp]> macros instead; see L</Putting a C value on Perl stack>. For more information, consult L<perlxs> and L<perlxstut>. +=head2 Autoloading with XSUBs + +If an AUTOLOAD routine is an XSUB, as with Perl subroutines, Perl puts the +fully-qualified name of the autoloaded subroutine in the $AUTOLOAD variable +of the XSUB's package. + +But it also puts the same information in certain fields of the XSUB itself: + + HV *stash = CvSTASH(cv); + const char *subname = SvPVX(cv); + STRLEN name_length = SvCUR(cv); /* in bytes */ + U32 is_utf8 = SvUTF8(cv); + +C<SvPVX(cv)> contains just the sub name itself, not including the package. + +B<Note>: Setting $AUTOLOAD stopped working in 5.6.1, which did not support +XS AUTOLOAD subs at all. Perl 5.8.0 introduced the use of fields in the +XSUB itself. Perl 5.16.0 restored the setting of $AUTOLOAD. If you need +to support 5.8-5.14, use the XSUB's fields. + =head2 Calling Perl Routines from within C Programs There are four routines that can be used to call a Perl subroutine from |