skazat has asked for the wisdom of the Perl Monks concerning the following question:
Hello All,
I'm trying to figure out a good way to do this in Perl.
Let's say I have an OO module, Widget and I have another, Widget::CheckBox. Widget::CheckBox is-a Widget - it inherits many of the things from Widget via the @ISA() array. How do I work with Widget::CheckBox from inside the Widget Object?
Do I just make a new instance of Widget::Checkbox within Widget? That sounds sort of wasteful. It seems I should be a ble to pass a reference to my Widget self, directly to Widget::Checkbox and have Widget::Checkbox see if it gets passed something like that. Basically, it would seem I want to do *both* of these things:
use Widget; my $w = new Widget; return $w->widgets->checkbox; # --- or -- use Widget::Checkbox; my $wc = Widget::Checkbox; print $wc->checkbox;
Am I making sense? :)
I'm guess I'm not clear on working with Perl while using a, "Has A" relationship;
-justin simoni
skazat me
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: has-a in Perl
by Roy Johnson (Monsignor) on Apr 18, 2005 at 20:00 UTC | |
by skazat (Chaplain) on Apr 18, 2005 at 20:06 UTC | |
by Joost (Canon) on Apr 19, 2005 at 11:04 UTC | |
|
Re: has-a in Perl
by cowboy (Friar) on Apr 18, 2005 at 20:17 UTC | |
by chromatic (Archbishop) on Apr 18, 2005 at 20:46 UTC | |
by cowboy (Friar) on Apr 18, 2005 at 23:03 UTC | |
|
Re: has-a in Perl
by dragonchild (Archbishop) on Apr 18, 2005 at 19:52 UTC |