Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Help understanding object constructors

by jbrugger (Parson)
on Nov 07, 2005 at 06:18 UTC ( [id://506242]=note: print w/replies, xml ) Need Help??


in reply to Re: Help understanding object constructors
in thread Help understanding object constructors

Correct.
But for standards (and to make it a bit more readable), it might be better to write it like this, although it's also a matter of taste :)
sub new { my $classname = shift; my %arg= ( _server => undef, _database => undef, _hSession => undef, _hDatabase} => undef, @_, ); my $self = {}; # note this corresponds whith $this in your code. bless $self, $classname; $self->{_server} = $arg{_server}; $self->{_database} = $arg{_database}; $self->{_hSession} = $arg{_hSession}; $self->{_hDatabase} = $arg{_hDatabase}; return $self; }

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Log In?
Username:
Password:

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

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

    No recent polls found