LanX has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I'm trying to inspect the symbols of a package and filter which arrays, hashes, scalars and subs where used.
This works pretty fine for all slots of a glob but for scalars!
Normally unused slots are undef or hold a reference to the corresponding type. (see ARRAYs)
But unused scalar slots automatically hold \undef which is not distinguishable from using them and setting them to undef.
DB<191> *PCKG::unknown{ARRAY} => undef DB<192> @PCKG::foo=(1,2,3) => (1, 2, 3) DB<193> *PCKG::foo{ARRAY} => [1, 2, 3] DB<194> *PCKG::foo{SCALAR} # why \undef and not undef ??? => \undef DB<195> $PCKG::foo=undef => undef DB<196> *PCKG::foo{SCALAR} # same effect => \undef DB<198> undef $PCKG::foo => undef DB<199> *PCKG::foo{SCALAR} # again => \undef
Any idea how to solve this?
Cheers Rolf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problem to inspect scalars in STASH
by educated_foo (Vicar) on Feb 15, 2012 at 05:08 UTC | |
by LanX (Saint) on Feb 15, 2012 at 16:05 UTC | |
by educated_foo (Vicar) on Feb 16, 2012 at 02:31 UTC | |
Re: Problem to inspect scalars in STASH
by ikegami (Patriarch) on Feb 15, 2012 at 04:38 UTC |
Back to
Seekers of Perl Wisdom