Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re (tilly) 2: OO vs. global variables...

by tilly (Archbishop)
on Sep 05, 2001 at 20:38 UTC ( [id://110345]=note: print w/replies, xml ) Need Help??


in reply to Re: OO vs. global variables...
in thread OO vs. global variables...

But note that there are good reasons to use singletons in Perl. The most common one for me is when the object is expensive to create (database connections etc) and might need to exist for many reasons, but might be possible to do without. In that case then you just use a singleton and issue calls to its constructor from wherever you need it.

Now no matter how complex the logic is to need it, it is there when you want, and you don't pay for it when you don't need it.

  • Comment on Re (tilly) 2: OO vs. global variables...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found