Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by Gilimanjaro (Hermit)
on Oct 05, 2007 at 11:44 UTC ( #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);


Comment on Re: Can locate when called directly, but can't when in @ISA
Download Code
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.

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; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2014-07-13 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (243 votes), past polls