Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: new() function: incorrect?

by fmerges (Chaplain)
on Nov 12, 2008 at 10:08 UTC ( #723099=note: print w/replies, xml ) Need Help??

in reply to Re: new() function: incorrect?
in thread new() function: incorrect?


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:


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...


fmerges at

Replies are listed 'Best First'.
Re^3: new() function: incorrect?
by ikegami (Pope) on Nov 12, 2008 at 17:28 UTC
    That won't even run. It dies of strictures. Definitely qualifies for worst.


      As you can imagine, there was no use of 'strict' and 'warnings' pragma nowhere, tests, what are tests? Don't want to mention more stuff as I'll get angry ;-)


      fmerges at

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://723099]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2017-07-22 01:44 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (336 votes). Check out past polls.