develooper Front page | perl.perl5.porters | Postings from June 2008

Re: How to dig through symbol tables

Thread Previous | Thread Next
From:
Sean O'Rourke
Date:
June 19, 2008 20:11
Subject:
Re: How to dig through symbol tables
Message ID:
m28wx0u7g9.fsf@cs.ucsd.edu
Ben Morrow <ben@morrow.me.uk> writes:
> Quoth sorourke@ucsd.edu:
>> Indeed, if any other slot is defined, *{FOO}{SCALAR} seems to be
>> defined.  Is this intended behavior?
>
> Yes. If a glob exists at all it has a SCALAR slot.
>
>> I am currently using *{FOO}{THING} for everything but scalars,
>> and (afterwards) "defined $FOO" for scalars, but it seems like
>> there should be a better way.
>> [...]
>
> 'defined $FOO' tells you whether the scalar contains undef or not, not
> whether it exists.

True.  But I think that short of force-upgrading the users of my
module to 5.10, this is the best I can do.  (It's being used for
variable-name completion, fwiw.)

By the way, here's a belated "thanks" to whoever wrote the code
enabling PERL_DONT_CREATE_GVSV.

Sean


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