On Oct 17, James Edward Gray II said:
>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;
>}
>This
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 final
Thanks all for the constructor suggestions, but I'm still having a few
problems. See comments below:
On Thursday, October 17, 2002, at 09:58 AM, NYIMI Jose (BMB) and Jeff
'japhy' Pinyan wrote:
On Oct 17, James Edward Gray II said:
sub new {
my $class = shift;
$class = ref $class if ref $c
On Oct 17, James Edward Gray II said:
>> {
>> no strict 'refs'; # sorry, but it's a bit more convenient this way
>> for (@{ "${class}::ISA" }) {
>> $self->initialize(%args);
>> }
>> }
>
>This calls the object's initialize method repeatedly, not the
>initialize of the parent
Well, I think I may have finally fixed it. The following appears to
work. Thanks again to all who helped me understand this problem better.
James
#!/usr/bin/perl
package Class::Initializable;
our $VERSION = 1.0.0;
use 5.6.0;
use strict;
use warnings;
sub new {
my $class = shift;
$class =
What about this:
> sub new {
> my $class = shift;
> $class = ref $class if ref $class;
> my %args = @_;
> my $self = bless { }, $class;
>
> # needs hierarchical initialization here
>
$self->SUPER::initialize(%args);
José.
DISCLAIMER
"This e-mai
On Oct 17, NYIMI Jose (BMB) said:
>> sub new {
>> my $class = shift;
>> $class = ref $class if ref $class;
>> my %args = @_;
>> my $self = bless { }, $class;
>>
>> # needs hierarchical initialization here
>>
> $self->SUPER::initialize(%args);
You might want to use D