in reply to Re: new() function: incorrect?
in thread new() function: incorrect?
Hi,
Actually the worst "constructor" I've seen so far came from someone who considered himself an expert and it was like this:
sub new{ my $self = shift; my $dbh = shift; $self->{dbh} = $dbh; return $self; }
On top of that also calls like the following from the caller:
$sDB->{dbh}->disconnect;
And it was not in one module, it was in the whole layer that deals with the DB from a web application running under mod_perl! You can imagine for yourself what sort of strange creatures were also lurking around...
Update: Added emphasis on the worst...Regards,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: new() function: incorrect?
by ikegami (Patriarch) on Nov 12, 2008 at 17:28 UTC | |
by fmerges (Chaplain) on Nov 13, 2008 at 12:08 UTC |