Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Multiple instances of the same base class

by Riales (Hermit)
on Feb 10, 2012 at 22:33 UTC ( #953139=note: print w/ replies, xml ) Need Help??


in reply to Multiple instances of the same base class

Usually, whenever you call a package's new method, it should already be returning a brand new instance of itself, so I would think what you have is already mostly correct.

Some other things I noticed though...

I think instead of:

use BasicX;
You actually want:
use base BasicX;

This is because use base establishes a ISA relationship for between your current class and the specified base class(es).

Beyond that, change this section:

my $newclass = BasicX->new(...);
To something like this:
my $newclass = $class->SUPER::new(...);
That should work properly.


Comment on Re: Multiple instances of the same base class
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2015-07-29 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls