develooper Front page | perl.perl5.porters | Postings from May 2004

Re: undef loses it magicness when assigned to a variable?

Thread Previous | Thread Next
From:
Tony Cook
Date:
May 27, 2004 01:03
Subject:
Re: undef loses it magicness when assigned to a variable?
Message ID:
20040527080318.GA8530@develop-help.com
On Thu, May 27, 2004 at 12:45:02AM -0700, Stas Bekman wrote:
> So how do I check in C whether the passed variable (or a random sv) is 
> undef or not if comparing to &PL_sv_undef doesn't work? am I missing some 
> obvious RTFM section? I've read: 'perlguts:=head2 AVs, HVs and undefined 
> values'
> but it doesn't seem to be related. There were many other references to 
> undef in the perl manpages, but I didn't find anything useful.

From perldoc perlguts:

       If you want to know if this variable (or any other SV) is
       actually "defined", you can call:

           SvOK(SV*)

I've always used this, but the documentation in perlapi:

       SvOK    Returns a boolean indicating whether the value is
               an SV.

                       bool    SvOK(SV* sv)

doesn't really lead you to it.

-- 
Tony


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About