Apd |SV* |eval_pv |NN const char* p|I32 croak_on_error
Apd |I32 |eval_sv |NN SV* sv|I32 flags
Apd |SV* |get_sv |NN const char* name|I32 create
-Apd |AV* |get_av |NN const char* name|I32 create
+Apd |AV* |get_av |NN const char *name|I32 flags
Apd |HV* |get_hv |NN const char *name|I32 flags
Apd |CV* |get_cv |NN const char* name|I32 flags
Apd |CV* |get_cvn_flags |NN const char* name|STRLEN len|I32 flags
BOOT:
{
HV *stash = gv_stashpvn("B", 1, GV_ADD);
- AV *export_ok = perl_get_av("B::EXPORT_OK",TRUE);
+ AV *export_ok = perl_get_av("B::EXPORT_OK", GV_ADD);
MY_CXT_INIT;
specialsv_list[0] = Nullsv;
specialsv_list[1] = &PL_sv_undef;
SV *dl_libref;
if ((sub = get_cv("DynaLoader::dl_unload_file", FALSE)) != NULL) {
- dl_librefs = get_av("DynaLoader::dl_librefs", FALSE);
+ dl_librefs = get_av("DynaLoader::dl_librefs", 0);
while ((dl_libref = av_pop(dl_librefs)) != &PL_sv_undef) {
dSP;
ENTER;
=for apidoc p||get_av
-Returns the AV of the specified Perl array. If C<create> is set and the
-Perl variable does not exist then it will be created. If C<create> is not
-set and the variable does not exist then NULL is returned.
+Returns the AV of the specified Perl array. C<flags> are passed to
+C<gv_fetchpv>. If C<GV_ADD> is set and the
+Perl variable does not exist then it will be created. If C<flags> is zero
+and the variable does not exist then NULL is returned.
=cut
*/
AV*
-Perl_get_av(pTHX_ const char *name, I32 create)
+Perl_get_av(pTHX_ const char *name, I32 flags)
{
- GV* const gv = gv_fetchpv(name, create, SVt_PVAV);
+ GV* const gv = gv_fetchpv(name, flags, SVt_PVAV);
PERL_ARGS_ASSERT_GET_AV;
- if (create)
+ if (flags)
return GvAVn(gv);
if (gv)
return GvAV(gv);
/* touch @F array to prevent spurious warnings 20020415 MJD */
if (PL_minus_a) {
- (void) get_av("main::F", TRUE | GV_ADDMULTI);
+ (void) get_av("main::F", GV_ADD | GV_ADDMULTI);
}
}
=item get_av
X<get_av>
-Returns the AV of the specified Perl array. If C<create> is set and the
-Perl variable does not exist then it will be created. If C<create> is not
-set and the variable does not exist then NULL is returned.
+Returns the AV of the specified Perl array. C<flags> are passed to
+C<gv_fetchpv>. If C<GV_ADD> is set and the
+Perl variable does not exist then it will be created. If C<flags> is zero
+and the variable does not exist then NULL is returned.
NOTE: the perl_ form of this function is deprecated.
- AV* get_av(const char* name, I32 create)
+ AV* get_av(const char *name, I32 flags)
=for hackers
Found in file perl.c
my_eval_sv(command, TRUE);
SvREFCNT_dec(command);
- *match_list = get_av("array", FALSE);
+ *match_list = get_av("array", 0);
num_matches = av_len(*match_list) + 1; /** assume $[ is 0 **/
return num_matches;
If you know the name of an array variable, you can get a pointer to its AV
by using the following:
- AV* get_av("package::varname", FALSE);
+ AV* get_av("package::varname", 0);
This returns NULL if the variable does not exist.
your Perl script, use the following routines, depending on the variable type.
SV* get_sv("package::varname", TRUE);
- AV* get_av("package::varname", TRUE);
+ AV* get_av("package::varname", GV_ADD);
HV* get_hv("package::varname", GV_ADD);
Notice the use of TRUE as the second parameter. The new variable can now
#define PERL_ARGS_ASSERT_GET_SV \
assert(name)
-PERL_CALLCONV AV* Perl_get_av(pTHX_ const char* name, I32 create)
+PERL_CALLCONV AV* Perl_get_av(pTHX_ const char *name, I32 flags)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_GET_AV \
assert(name)