Please, tell me hierarchical construction/destruction is on the Perl 6
checklist! I come from a Java background and Perl and I just don't see
eye to eye here. Okay, my problem:
I'm building a class hierarchy and the constuctors are getting the
better of me. I think I've finally settled on a solution I like, out
of Damian's Object Oriented Perl, but it needs one more touch.
Basically, I have EVERYTHING in the hierarchy inheriting from this:
#!/usr/bin/perl
package Utility::Initializable;
our $VERSION = 1.0.0;
use 5.6.0;
use strict;
use warnings;
sub new {
my $class = shift;
$class = ref $class if ref $class;
my %args = @_;
my $self = bless { }, $class;
# needs hierarchical initialization here
$self->initialize(%args);
return $self;
}
sub initialize { die "Abstract method: must override!\n"; }
1;
__END__
This is good, I just give everything an initialize() method. The
problem is that I have to remember to call the parents initialize().
Is there a way to get a hold of the referent's @ISA array, where my
comment is above, and perform the needed initializations so my objects
don't have to?
Thanks for your time.
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- RE: Hierarchical Construction/Destruction NYIMI Jose (BMB)
- RE: Hierarchical Construction/Destruction Jeff 'japhy' Pinyan
- Re: Hierarchical Construction/Destruction James Edward Gray II
- Re: Hierarchical Construction/Destruction Jeff 'japhy' Pinyan
- Re: Hierarchical Construction/Destructio... James Edward Gray II
- Re: Hierarchical Construction/Destru... James Edward Gray II
- Re: Hierarchical Construction/Destru... Jeff 'japhy' Pinyan
