Skip Menu |

This queue is for tickets about the Devel-Symdump CPAN distribution.

Report information
The Basics
Id: 77102
Status: patched
Priority: 0/
Queue: Devel-Symdump

People
Owner: Nobody in particular
Requestors: WULEE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



So far as I can tell this code erroneously reports a scalar $moo: { package X; our @moo; } use Devel::Symdump; use Data::Dumper; print Devel::Symdump->new("X")->scalars; # prints "X::moo" Googling, I gather this isn't strictly a bug in this module, but more a "feature" of Perl, for example see this thread: http://stackoverflow.com/questions/3391572/perl-iterate-over-a-typeglob Specifically, from perlref (perl 5.14.2): *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. So in the above example in general it is impossible to tell if $moo was declared or not, unless it has been assigned a defined value. Even though nothing much can be done about this, I think it would be useful to specifically point it out in the documentation, and save uninformed users some head-scratching. A suggested amendment is attached, but anything equivalent would do. References to similar modules with different approaches might also help (e.g. Package::Stash which attempts to go a step further than this one and check if a scalar entry is defined, which may be useful in some cases).
Subject: Symdump.pm.diff
--- Symdump.pm~ 2007-06-25 07:07:38.000000000 +0100 +++ Symdump.pm 2012-05-10 00:08:44.683643430 +0100 @@ -371,6 +371,13 @@ symbols. Unknown symbols are usually either formats or variables that haven't yet got a defined value. +Note that scalar symbol table entries are a special case. If a symbol +table entry exists at all, presence of a scalar is currently +unknowable, due to a feature of Perl described in perlref "Making +References" point 7. For example, this package will mark a scalar +value C<$foo> as present if any of C<@foo>, C<%foo>, C<&foo> etc. have +been declared or used. + =item as_string =item as_HTML
ANDK/Devel-Symdump-2.08_53.tar.gz has just been uploaded to cpan with your patch applied. Thank you very much.