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

Re: Never letting package objects to go out of scope

by LanceDeeply (Chaplain)
on Feb 11, 2003 at 03:08 UTC ( [id://234305]=note: print w/replies, xml ) Need Help??


in reply to Never letting package objects to go out of scope

If you don't require a stateful object, the Singleton may be the way to go. But if the methods change the state of your shared object, and you have multiple places in your code that call the object, you'll probably have to create separate instances.

You may want to consider a ResourcePool:

The ResourcePool is a generic connection caching and pooling management facility. It might be used in an Apache/mod_perl environment to support connection caching like Apache::DBI for non-DBI resources (e.g. Net::LDAP). It's also useful in a stand alone perl application to handle connection pools.

The key benefit of ResourcePool is the generic design which makes it easily extensible to new resource types.

The good monks here pointed me towards it after I tried creating a pool for DBI handles.
  • Comment on Re: Never letting package objects to go out of scope

Log In?
Username:
Password:

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

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

    No recent polls found