No such thing as a small change | |
PerlMonks |
Re: Never letting package objects to go out of scopeby LanceDeeply (Chaplain) |
on Feb 11, 2003 at 03:08 UTC ( [id://234305]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|