Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Symbolic reference with strict "refs"

by broquaint (Abbot)
on Aug 17, 2012 at 20:05 UTC ( #988092=note: print w/ replies, xml ) Need Help??


in reply to Symbolic reference with strict "refs"

In your specific example you have at least two options:

  1. Rummage through package stashes and globs e.g
    @Foo::ISA = qw(Hello World); use strict; use feature 'say'; my $class = 'Foo'; my $isa = *{ $main::{"$class\::"}{ISA} }{ARRAY}; say "@$isa"; # Hello World
  2. Use the core package Symbol and make use of qualify_to_ref e.g
    @Foo::ISA = qw(Hello World); use strict; use feature 'say'; use Symbol 'qualify_to_ref'; my $class = 'Foo'; my $isa = *{qualify_to_ref 'ISA', $class}{ARRAY}; say "@$isa"; # Hello World
The former won't work with nested packages whereas the latter will.
HTH

_________
broquaint


Comment on Re: Symbolic reference with strict "refs"
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-07-30 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls