diff --git a/embed.fnc b/embed.fnc index 0d27939e0a..a6b4d0350f 100644 --- a/embed.fnc +++ b/embed.fnc @@ -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 diff --git a/gv.c b/gv.c index 42d2ad8128..d89bfcb16b 100644 --- a/gv.c +++ b/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 whose name is given by the inputs, +or NULL if no GV of that name and type could be found. See L. + +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 in its name. They +all have a C parameter in fact, and all the flag bits have the same +meanings for all + +If any of the flags C, C, C, C, or +C is set, a GV is created if none already exists for the input name +and type. However, C will only do the creation for magical GV's. +For all of these flags except C, C> is called after +the addition. C 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 +flag means to pretend that the GV has been seen before (I, suppress "Used +once" warnings). + +The flag C causes C> not be to called if the +GV existed but isn't PVGV. + +If the C 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-named forms, +and the UTF-8ness of the underlying SVs will be used in the C forms. + +If the flag C 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, C is a C string, NUL-terminated with no intermediate +NULs. + +In C, C is a literal C string, hence is enclosed in +double quotes. + +C and C are identical. In these, is +a Perl string whose byte length is given by C, and may contain +embedded NULs. + +In C and C, the name is extracted from the PV of +the input C SV. The only difference between these two forms is that +'get' magic is normally done on C in C, and always skipped +with C. Including C in the C parameter +to C makes it behave identically to C. + +=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)