Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Answer: How do I make a constructor? (different responsibilities)

by Aristotle (Chancellor)
on Apr 13, 2003 at 12:51 UTC ( [id://250128]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250128]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 09:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found