I just finished up cleaning up the mess I created. The end result was a combination of using test case registering, and because of the structure and portability of what I'm working with I had to add @ISA for what I was calling the "parent" inside what I was calling the "child". My end result of this discussion took me A LOT further than I ever thought I was going to get with it! This isn't something I would ever do as design, but here is an example in concept of what I did:
#!/usr/bin/perl
use strict;
use warnings;
package Top;
sub new {
my ($class, %params) = @_;
my $self = bless \%params, $class;
return $self;
}
sub firstSub {
my ($class) = @_;
print "FIRST SUB!\n";
}
package Top::Extend1;
push @Top::ISA, 'Top::Extend1';
sub addOnSub {
my ($self) = @_;
print "ADD ON\n";
}
package Top::Extend2;
push @Top::ISA, 'Top::Extend2';
sub secondAddOn {
my ($self) = @_;
print "SECOND ADD ON\n";
}
package main;
my $test = Top->new();
$test->firstSub();
$test->addOnSub();
$test->secondAddOn();
So the way I was saying it was backwards making my question confusing to what my actual goal was. I'm sure this is very "hand slapish" behavior and complicated when it comes to overridden methods... but that was the key to solving my dilemma.
Thanks for the help and enlightenment Monks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.