I think you mostly want that so you can check whether something can influence how a class behaves, which seems to point mostly to @ISA to me (barring weirdo UNIVERSAL or MRO trickery). If you want to check whether @Some::Package::ISA exists, you can look into the namespace hash:
#!perl -w use Data::Dumper; sub isa_exists { my ($package) = @_; exists ${"$package\::"}{ISA} and defined *{${"$package\::"}{ISA}}{ +ARRAY}; }; print "Now you don't\n"; print isa_exists('Some::Package'),"\n"; eval q(package Some::Package;@ISA='foo';); print "Now you see it\n"; print isa_exists('Some::Package'),"\n"; print "Now you don't\n"; print isa_exists('Some::Other::Package'),"\n"; print "Now you don't\n"; print isa_exists('Some::Other::Package'),"\n"; eval q(require A::Package::That::Doesn't::Exist); print "A::Package::That::Doesn't::Exist ($@)\n"; print isa_exists("A::Package::That::Doesn't::Exist");
In reply to Re: How Can I Know If a Package is "Real"?
by Corion
in thread How Can I Know If a Package is "Real"?
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |