Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

•Re: Perl Singletons

by merlyn (Sage)
on Jul 19, 2002 at 19:52 UTC ( #183419=note: print w/replies, xml ) Need Help??

in reply to Perl Singletons

There's no point in even returning an instance. Just return the package name:
package DBconnector; my $dbh; sub new { return __PACKAGE__ } sub connect { my $pointless = shift; $dbh ||= DBI->connect($@); }
and so on.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re^2: Perl Singletons
by Aristotle (Chancellor) on Jul 19, 2002 at 20:44 UTC
    $dbh ||= DBI->connect($@);

    You probably mean @_ there.. at least I can't see an eval anywhere *grin*

    ++ tho. :)

    Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183419]
Discipulus nevers ignores who is here since ever
[Eily]: IIRC 3% of all humans in history never ever died
[NodeReaper]: this is emotional, what did I do to deserve this?
[Discipulus]: Eily this percentage get higher everyday i suppose
Discipulus sometimes i'm here alone with you, bony brother
[Discipulus]: ok a Perl one: how approach the task of getting all distinct paths from the edge to a node of a pascal triangle (nobackwards)?

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2018-03-19 10:49 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.