My advice is no strict 'refs'; ## no critic. strict and perlcritic are meant to be tools that help you. When they are not helping you, you should disable them (in the smallest scope possible); you shouldn't be forced to jump through hoops.
That said, a bit of stash exploration can get you there...
use 5.010; use strict; use warnings; { package Foo::Bar; our @ISA = qw(Quux); } sub get_isa { my $klass = shift; my $stash = \%::; for my $part (split '::', $klass) { $stash = \%{ *{ $stash->{$part . '::'} } }; } $stash->{ISA}; } my $isa = get_isa('Foo::Bar'); say "Foo::Bar isa $_" for @$isa;
That's actually less grokkable than using symbolic references.
There is a package called Package::Stash (used extensively by Moose) which wraps some of this up in a cleaner API. But my vote is to use symbolic references.
In reply to Re: Symbolic reference with strict "refs"
by tobyink
in thread Symbolic reference with strict "refs"
by denishowe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |