http://www.perlmonks.org?node_id=642901


in reply to Can locate when called directly, but can't when in @ISA

@ISA doesn't magically load the classes you're inheriting from. The child class Lens still needs to load (use) the parent class Cloud.

Also, you may want to 'use strict' and 'use warnings' and prefix @ISA with 'our'.

You can do both by using the 'base' pragma:

use base qw(Exporter Cloud);

Replies are listed 'Best First'.
Re^2: Can locate when called directly, but can't when in @ISA
by almut (Canon) on Oct 05, 2007 at 13:01 UTC
    You can do both by using the 'base' pragma

    ... but before switching to "use base", the OP may want to form his own opinion about the objections a couple of renowned monks have had in the thread 'base' versus @ISA, why?.

      That was helpful information, but I am no an OOP super freak either. For my needs, use base 'parent'; works perfectly and I am able to easily augment the parent's creation class with out any problems:
      use base 'My::Parent::Class'; sub new { my $pkg = shift; my $self = $pkg->SUPER::new(@_); return $self; }
Re^2: Can locate when called directly, but can't when in @ISA
by Phemto (Acolyte) on Oct 05, 2007 at 11:57 UTC
    Wohoo! Was that a rookie mistake, or what? Thanks! Now I just need to figure out why some of my modules aren't returning true values, but that's a separate issue. And yes, I have a "1;" at the end. :->

    Thanks again.