ViceRaid has asked for the wisdom of the Perl Monks concerning the following question:

Hi

Perhaps a silly question, but how do I get the symbol table of my current package, using __PACKAGE__? I'm wanting to write something like:

my %symbols = %{__PACKAGE__}::

but it doesn't work. What syntax should I be using?

cheers
ViceRaid

Replies are listed 'Best First'.
Re: getting my own __PACKAGE__'s symbol table
by broquaint (Abbot) on Sep 17, 2003 at 11:08 UTC
    You need to reference it symbolically within the dereference block e.g
    my %syms = %{ __PACKAGE__ . '::' };
    So you construct the string name of the package and then the dereference block accesses the package that goes by that name.
    HTH

    _________
    broquaint