Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Devel::Symdump and symbol table woes

by broquaint (Abbot)
on Nov 10, 2005 at 15:47 UTC ( #507415=note: print w/ replies, xml ) Need Help??


in reply to Devel::Symdump and symbol table woes

You're seeing this behaviour because all globs slots contain references to their respective data types (as expounded upon in Of Symbol Tables and Globs). So Devel::Symdump only appears to be behaving errantly in this case, since one can't distinguish between a SCALAR slot containing nothing and a SCALAR slot which has been explicitly set to undef, such is the nature of globs :/

HTH

_________
broquaint


Comment on Re: Devel::Symdump and symbol table woes
Re^2: Devel::Symdump and symbol table woes
by trammell (Priest) on Sep 17, 2007 at 17:43 UTC
    Just a couple of notes as a I retrace my understanding of this behavior. Here's some relevant text from perlref, section "Making References":
    *foo{THING} returns undef if that particular THING hasnít been used yet, except in the case of scalars. *foo{SCALAR} returns a reference to an anonymous scalar if $foo hasnít been used yet. This might change in a future release.
    One consequence of this is that at the symbol-table level, the following two packages are indistinguishable:
    { package Foo; our $x = undef; our @x = qw( alpha beta gamma ); } { package Bar; our @x = qw( alpha beta gamma ); }
    ... which I may demonstrate with some code of my own, once I come up with something convincing that navigates the sea of casting and dereferencing that is the Perl symbol table. So while I think I appreciate what broquaint is trying to get across, I don't think the above post addresses the "spirit" of the OP. I would agree with the as-yet unmade statement that Devel::Symdump is doing its best, but the underlying data is ambiguous, and so are the values returned from the module.

    Indeed, such is the nature of globs. Thanks, bpphillips, for starting this conversation.

    Update: Here's a more concrete example, following the package definitions above:

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://507415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-09-30 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (385 votes), past polls