summaryrefslogtreecommitdiff
path: root/pod/perlguts.pod
diff options
context:
space:
mode:
authorStas Bekman <stas@stason.org>2004-05-27 04:25:08 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-05-28 06:29:28 +0000
commit9adebda4fef8cbc5965f9327c10fca15b814f305 (patch)
tree5890001db3450e8b95ce0d8e37fbe0215d978f8e /pod/perlguts.pod
parent0b8342839983807250e9f986d89f01500807f071 (diff)
downloadperl-9adebda4fef8cbc5965f9327c10fca15b814f305.tar.gz
Re: undef loses it magicness when assigned to a variable?
Message-ID: <40B63284.5040203@stason.org> p4raw-id: //depot/perl@22853
Diffstat (limited to 'pod/perlguts.pod')
-rw-r--r--pod/perlguts.pod19
1 files changed, 16 insertions, 3 deletions
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 9932b37547..99c79d0a43 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -201,9 +201,22 @@ you can call:
SvOK(SV*)
The scalar C<undef> value is stored in an SV instance called C<PL_sv_undef>.
-Its address can be used whenever an C<SV*> is needed.
-However, you have to be careful when using C<&PL_sv_undef> as a value in AVs
-or HVs (see L<AVs, HVs and undefined values>).
+
+Its address can be used whenever an C<SV*> is needed. Make sure that
+you don't try to compare a random sv with C<&PL_sv_undef>. For example
+when interfacing Perl code, it'll work correctly for:
+
+ foo(undef);
+
+But won't work when called as:
+
+ $x = undef;
+ foo($x);
+
+So to repeat always use SvOK() to check whether an sv is defined.
+
+Also you have to be careful when using C<&PL_sv_undef> as a value in
+AVs or HVs (see L<AVs, HVs and undefined values>).
There are also the two values C<PL_sv_yes> and C<PL_sv_no>, which contain
boolean TRUE and FALSE values, respectively. Like C<PL_sv_undef>, their