diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-01-21 15:03:03 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-01-21 17:09:11 +0000 |
commit | 64ace3f88f559d007c0150d9b048b1db32380208 (patch) | |
tree | 042e7da9dbe9f7d2a0291fe3763130f50198e559 /pod | |
parent | cbfd0a879b2bf2ade4a309e6d56c08ba19f320e1 (diff) | |
download | perl-64ace3f88f559d007c0150d9b048b1db32380208.tar.gz |
Update the documentation of get_sv() to note that it calls Perl_gv_fetchpv(),
and hence the 'create' argument is actually 'flags'. Fix core code and
documentation that used TRUE or FALSE to use 0 or GV_ADD.
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perl5005delta.pod | 2 | ||||
-rw-r--r-- | pod/perlapi.pod | 11 | ||||
-rw-r--r-- | pod/perlembed.pod | 8 | ||||
-rw-r--r-- | pod/perlguts.pod | 6 |
4 files changed, 14 insertions, 13 deletions
diff --git a/pod/perl5005delta.pod b/pod/perl5005delta.pod index 39646b66dc..6420f87fa9 100644 --- a/pod/perl5005delta.pod +++ b/pod/perl5005delta.pod @@ -101,7 +101,7 @@ If you see a compiler error that talks about the variable C<thr> not being declared (when building a module that has XS code), you need to add C<dTHR;> at the beginning of the block that elicited the error. -The API function C<perl_get_sv("@",FALSE)> should be used instead of +The API function C<perl_get_sv("@",GV_ADD)> should be used instead of directly accessing perl globals as C<GvSV(errgv)>. The API call is backward compatible with existing perls and provides source compatibility with threading is enabled. diff --git a/pod/perlapi.pod b/pod/perlapi.pod index 02e5f2686f..fc51e14034 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -3987,13 +3987,14 @@ Found in file universal.c =item get_sv X<get_sv> -Returns the SV of the specified Perl scalar. 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 SV of the specified Perl scalar. 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. - SV* get_sv(const char* name, I32 create) + SV* get_sv(const char *name, I32 flags) =for hackers Found in file perl.c @@ -7335,7 +7336,7 @@ sidestepping the normal C order of execution. See C<warn>. If you want to throw an exception object, assign the object to C<$@> and then pass C<NULL> to croak(): - errsv = get_sv("@", TRUE); + errsv = get_sv("@", GV_ADD); sv_setsv(errsv, exception_object); croak(NULL); diff --git a/pod/perlembed.pod b/pod/perlembed.pod index a2b76fdc28..39364eb429 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -325,15 +325,15 @@ the first, a C<float> from the second, and a C<char *> from the third. /** Treat $a as an integer **/ eval_pv("$a = 3; $a **= 2", TRUE); - printf("a = %d\n", SvIV(get_sv("a", FALSE))); + printf("a = %d\n", SvIV(get_sv("a", 0))); /** Treat $a as a float **/ eval_pv("$a = 3.14; $a **= 2", TRUE); - printf("a = %f\n", SvNV(get_sv("a", FALSE))); + printf("a = %f\n", SvNV(get_sv("a", 0))); /** Treat $a as a string **/ eval_pv("$a = 'rekcaH lreP rehtonA tsuJ'; $a = reverse($a);", TRUE); - printf("a = %s\n", SvPV_nolen(get_sv("a", FALSE))); + printf("a = %s\n", SvPV_nolen(get_sv("a", 0))); perl_destruct(my_perl); perl_free(my_perl); @@ -457,7 +457,7 @@ been wrapped here): retval = my_eval_sv(command, TRUE); SvREFCNT_dec(command); - *string = get_sv("string", FALSE); + *string = get_sv("string", 0); return SvIV(retval); } diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 8231592db0..6408e87422 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -191,7 +191,7 @@ have "magic". See L<Magic Virtual Tables> later in this document. If you know the name of a scalar variable, you can get a pointer to its SV by using the following: - SV* get_sv("package::varname", FALSE); + SV* get_sv("package::varname", 0); This returns NULL if the variable does not exist. @@ -667,7 +667,7 @@ to write: To create a new Perl variable with an undef value which can be accessed from your Perl script, use the following routines, depending on the variable type. - SV* get_sv("package::varname", TRUE); + SV* get_sv("package::varname", GV_ADD); AV* get_av("package::varname", GV_ADD); HV* get_hv("package::varname", GV_ADD); @@ -878,7 +878,7 @@ following code: extern int dberror; extern char *dberror_list; - SV* sv = get_sv("dberror", TRUE); + SV* sv = get_sv("dberror", GV_ADD); sv_setiv(sv, (IV) dberror); sv_setpv(sv, dberror_list[dberror]); SvIOK_on(sv); |