Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Can locate when called directly, but can't when in @ISA

by Gilimanjaro (Hermit)
on Oct 05, 2007 at 11:44 UTC ( [id://642901]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-26 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found