In Perl, given a package name “My::Package” in a scalar $myScalar what is the best why to determine if My::Package has a parent called “My::Package::Parent”? The restraints here are that My::Package may not already be loaded and that we don’t know the required parameters for the class constructor.
Thanks
Well, you can’t know what a class has for parent until the class exists, so you need to load the module that defines it. Then you can use the UNIVERSAL method
isato find if it inherits fromMy::Package::Parent.Reference: