mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
Document gv_fetch[ps]v and kin
This commit is contained in:
parent
0bfb46833b
commit
84ca0d8249
@ -972,7 +972,7 @@ Apx |GV* |gv_fetchmethod_pv_flags|NN HV* stash|NN const char* name \
|
||||
|U32 flags
|
||||
Apx |GV* |gv_fetchmethod_pvn_flags|NN HV* stash|NN const char* name \
|
||||
|const STRLEN len|U32 flags
|
||||
Ap |GV* |gv_fetchpv |NN const char *nambeg|I32 flags|const svtype sv_type
|
||||
Adp |GV* |gv_fetchpv |NN const char *nambeg|I32 flags|const svtype sv_type
|
||||
AbpD |void |gv_fullname |NN SV* sv|NN const GV* gv
|
||||
ApMb |void |gv_fullname3 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix
|
||||
Ap |void |gv_fullname4 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix|bool keepmain
|
||||
@ -3476,8 +3476,8 @@ Sxd |SV* |find_uninit_var|NULLOK const OP *const obase \
|
||||
|NN const char **desc_p
|
||||
#endif
|
||||
|
||||
Ap |GV* |gv_fetchpvn_flags|NN const char* name|STRLEN len|I32 flags|const svtype sv_type
|
||||
Ap |GV* |gv_fetchsv|NN SV *name|I32 flags|const svtype sv_type
|
||||
Adp |GV* |gv_fetchpvn_flags|NN const char* name|STRLEN len|I32 flags|const svtype sv_type
|
||||
Adp |GV* |gv_fetchsv|NN SV *name|I32 flags|const svtype sv_type
|
||||
|
||||
#ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
|
||||
: Used in sv.c
|
||||
|
||||
71
gv.c
71
gv.c
@ -1604,8 +1604,6 @@ Perl_gv_stashsv(pTHX_ SV *sv, I32 flags)
|
||||
PERL_ARGS_ASSERT_GV_STASHSV;
|
||||
return gv_stashsvpvn_cached(sv, NULL, 0, flags);
|
||||
}
|
||||
|
||||
|
||||
GV *
|
||||
Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 flags, const svtype sv_type) {
|
||||
PERL_ARGS_ASSERT_GV_FETCHPV;
|
||||
@ -2368,6 +2366,75 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=for apidoc gv_fetchpv
|
||||
=for apidoc_item |GV *|gv_fetchpvn|const char * nambeg|STRLEN full_len|I32 flags|const svtype sv_type
|
||||
=for apidoc_item ||gv_fetchpvn_flags
|
||||
=for apidoc_item |GV *|gv_fetchpvs|"name"|I32 flags|const svtype sv_type
|
||||
=for apidoc_item ||gv_fetchsv
|
||||
=for apidoc_item |GV *|gv_fetchsv_nomg|SV *name|I32 flags|const svtype sv_type
|
||||
|
||||
These all return the GV of type C<sv_type> whose name is given by the inputs,
|
||||
or NULL if no GV of that name and type could be found. See L<perlguts/Stashes
|
||||
and Globs>.
|
||||
|
||||
The only differences are how the input name is specified, and if 'get' magic is
|
||||
normally used in getting that name.
|
||||
|
||||
Don't be fooled by the fact that only one form has C<flags> in its name. They
|
||||
all have a C<flags> parameter in fact, and all the flag bits have the same
|
||||
meanings for all
|
||||
|
||||
If any of the flags C<GV_ADD>, C<GV_ADDMG>, C<GV_ADDWARN>, C<GV_ADDMULTI>, or
|
||||
C<GV_NOINIT> is set, a GV is created if none already exists for the input name
|
||||
and type. However, C<GV_ADDMG> will only do the creation for magical GV's.
|
||||
For all of these flags except C<GV_NOINIT>, C<L</gv_init_pvn>> is called after
|
||||
the addition. C<GV_ADDWARN> is used when the caller expects that adding won't
|
||||
be necessary because the symbol should already exist; but if not, add it
|
||||
anyway, with a warning that it was unexpectedly absent. The C<GV_ADDMULTI>
|
||||
flag means to pretend that the GV has been seen before (I<i.e.>, suppress "Used
|
||||
once" warnings).
|
||||
|
||||
The flag C<GV_NOADD_NOINIT> causes C<L</gv_init_pvn>> not be to called if the
|
||||
GV existed but isn't PVGV.
|
||||
|
||||
If the C<SVf_UTF8> bit is set, the name is treated as being encoded in UTF-8;
|
||||
otherwise the name won't be considered to be UTF-8 in the C<pv>-named forms,
|
||||
and the UTF-8ness of the underlying SVs will be used in the C<sv> forms.
|
||||
|
||||
If the flag C<GV_NOTQUAL> is set, the caller warrants that the input name is a
|
||||
plain symbol name, not qualified with a package, otherwise the name is checked
|
||||
for being a qualified one.
|
||||
|
||||
In C<gv_fetchpv>, C<nambeg> is a C string, NUL-terminated with no intermediate
|
||||
NULs.
|
||||
|
||||
In C<gv_fetchpvs>, C<name> is a literal C string, hence is enclosed in
|
||||
double quotes.
|
||||
|
||||
C<gv_fetchpvn> and C<gv_fetchpvn_flags> are identical. In these, <nambeg> is
|
||||
a Perl string whose byte length is given by C<full_len>, and may contain
|
||||
embedded NULs.
|
||||
|
||||
In C<gv_fetchsv> and C<gv_fetchsv_nomg>, the name is extracted from the PV of
|
||||
the input C<name> SV. The only difference between these two forms is that
|
||||
'get' magic is normally done on C<name> in C<gv_fetchsv>, and always skipped
|
||||
with C<gv_fetchsv_nomg>. Including C<GV_NO_SVGMAGIC> in the C<flags> parameter
|
||||
to C<gv_fetchsv> makes it behave identically to C<gv_fetchsv_nomg>.
|
||||
|
||||
=for apidoc Amnh||GV_ADD
|
||||
=for apidoc Amnh||GV_ADDMG
|
||||
=for apidoc Amnh||GV_ADDMULTI
|
||||
=for apidoc Amnh||GV_ADDWARN
|
||||
=for apidoc Amnh||GV_NOADD_NOINIT
|
||||
=for apidoc Amnh||GV_NOINIT
|
||||
=for apidoc Amnh||GV_NOTQUAL
|
||||
=for apidoc Amnh||GV_NO_SVGMAGIC
|
||||
=for apidoc Amnh||SVf_UTF8
|
||||
|
||||
=cut
|
||||
*/
|
||||
|
||||
GV *
|
||||
Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
|
||||
const svtype sv_type)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user