in reply to Re: Accessing module variables
in thread Accessing module variables

Some code for introspection.

Used strict to demonstrate clean approaches

DB<80> package ABC::Foo; our $User='talexb'

> Well you could inspect the package stash(es) instead of using eval. *

DB<81> use strict;print ${ $main::{"ABC::"}{"Foo::"}{User} } talexb

> Another approach without eval is using symbolic refs, you need to locally no strict 'refs'; for that.

DB<82> use strict; no strict 'refs'; print ${ 'ABC::Foo::User' } talexb

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

*) NB: you could also avoid the main:: stash and hardcode

DB<99> use strict;print ${ $ABC::{"Foo::"}{User} } talexb

if ABC is static in your code.