http://qs321.pair.com?node_id=250128


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.

  • Comment on Re: Answer: How do I make a constructor? (different responsibilities)
  • Download Code