summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-05-19 09:35:14 -0600
committerKarl Williamson <khw@cpan.org>2022-05-28 14:59:35 -0600
commitdf91ed1f415ca48d067005116ac554c99bb257be (patch)
treee64ebdd6eeb0ef9239962f05c638532820cc3f6e
parent2356f8bb5077e29623007d815dab58f43473a56d (diff)
downloadperl-df91ed1f415ca48d067005116ac554c99bb257be.tar.gz
perlapi: Document gv_autoload*
-rw-r--r--embed.fnc6
-rw-r--r--gv.c30
2 files changed, 33 insertions, 3 deletions
diff --git a/embed.fnc b/embed.fnc
index 0970fe9de9..7afe4cd399 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -952,10 +952,10 @@ ApdMb |GV* |gv_HVadd |NULLOK GV *gv
ApdMb |GV* |gv_IOadd |NULLOK GV* gv
AdmR |GV* |gv_autoload4 |NULLOK HV* stash|NN const char* name \
|STRLEN len|I32 method
-ApR |GV* |gv_autoload_sv |NULLOK HV* stash|NN SV* namesv|U32 flags
-ApR |GV* |gv_autoload_pv |NULLOK HV* stash|NN const char* namepv \
+ApRd |GV* |gv_autoload_sv |NULLOK HV* stash|NN SV* namesv|U32 flags
+ApRd |GV* |gv_autoload_pv |NULLOK HV* stash|NN const char* namepv \
|U32 flags
-ApR |GV* |gv_autoload_pvn |NULLOK HV* stash|NN const char* name \
+ApRd |GV* |gv_autoload_pvn |NULLOK HV* stash|NN const char* name \
|STRLEN len|U32 flags
Cp |void |gv_check |NN HV* stash
AbpD |void |gv_efullname |NN SV* sv|NN const GV* gv
diff --git a/gv.c b/gv.c
index 32b00bb851..0c8edcd554 100644
--- a/gv.c
+++ b/gv.c
@@ -1293,6 +1293,36 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV *stash, const char *name, const STRLEN le
return gv;
}
+
+/*
+=for apidoc gv_autoload_pv
+=for apidoc_item gv_autoload_pvn
+=for apidoc_item gv_autoload_sv
+
+These each search for an C<AUTOLOAD> method, returning NULL if not found, or
+else returning a pointer to its GV, while setting the package
+L<C<$AUTOLOAD>|perlobj/AUTOLOAD> variable to C<name> (fully qualified). Also,
+if found and the GV's CV is an XSUB, the CV's PV will be set to C<name>, and
+its stash will be set to the stash of the GV.
+
+Searching is done in L<C<MRO> order|perlmroapi>, as specified in
+L</C<gv_fetchmeth>>, beginning with C<stash> if it isn't NULL.
+
+The forms differ only in how C<name> is specified.
+
+In C<gv_autoload_pv>, C<namepv> is a C language NUL-terminated string.
+
+In C<gv_autoload_pvn>, C<name> points to the first byte of the name, and an
+additional parameter, C<len>, specifies its length in bytes. Hence, C<*name>
+may contain embedded-NUL characters.
+
+In C<gv_autoload_sv>, C<*namesv> is an SV, and the name is the PV extracted
+from that using L</C<SvPV>>. If the SV is marked as being in UTF-8, the
+extracted PV will also be.
+
+=cut
+*/
+
GV*
Perl_gv_autoload_sv(pTHX_ HV *stash, SV* namesv, U32 flags)
{