in reply to Finding out if a scalar exists in a typeglob

You can get at them if the underlying scalars are defined:
while (my ($sym_name, $sym_glob) = each %{"${pkg}::"}) { push(@things, $sym_name) if (defined ${ *$sym_glob{SCALAR} }) ; }
Unfortunately, if they've been declared but never initialized, I can't seem to get at them in five minutes of trying. The trick you came up with for coderefs doesn't do the job here.

Replies are listed 'Best First'.
RE: Re: Finding out if a scalar exists in a typeglob
by davorg (Chancellor) on Oct 23, 2000 at 20:29 UTC

    Thanks for trying.

    Like merlyn says, it's a space optimisation. As a scalar takes as much room as a reference to it would, each typeglob comes with a free scalar. Which is good most of the time, but a little frustrating here :(

    Your fix will, at least, get me a bit closer and will presumably remove things like STDOUT from the list.

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me