in reply to Re: How do I make a constructor?
in thread How do I make a constructor?
I'd be inclined to write that as follows:
sub new { return (bless {}, shift)->init(@_); } sub init { my $self = shift; $self->SUPER::init(@_); 1 # put stuff to initialize here or die "Failed to init $self: blah blah\n"; return $self; }
Makeshifts last the longest.
|
---|
In Section
Seekers of Perl Wisdom