Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It really doesn't matter what you call it. I tend to give it a name in context with the name of the module. For instance, I am writing a wrapper around DBI.pm to handle all my database calls and I call the instantiating subroutine connect.
What is important is that you have a sub that blesses a hash. Objects are really hash references and blessing allows them to call subs from their module as well as the information stored within them. To be specific, you need: #... my $self = bless {}; #... return $self; # Note that 'return $self' is not required if bless is on the last line of your code and you don't assign the bless to a scalar. Hope that helps! In reply to Re: construct a standard object oriented program
by Anonymous Monk
|
|