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

Re: How to dig through symbol tables

Thread Previous | Thread Next
Sean O'Rourke
June 19, 2008 20:11
Re: How to dig through symbol tables
Message ID:
Ben Morrow <> writes:
> Quoth
>> 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


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About