Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by Aristotle (Chancellor)
on Apr 13, 2003 at 12:51 UTC ( #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? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-10-20 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (79 votes). Check out past polls.

    Notices?