in reply to Avoiding global object handle
As the modules, written as OO modules, are written for reuse between applications there is no logical reason to instantiate more than one object of the class within the application using the module. At the moment of instantiation an object handle is retrieved and stored.Then you don't really have instances any more. You have a singleton. And a package is a fine singleton.
Don't make the same mistake as our favorite whipping boy, CGI.pm. If you're always going to have at most one of a thing in an application, use class methods, not instances methods, and lexical variables for member variables. Fast. Easy. And subclassable, if done right.
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: •Re: Avoiding global object handle
by gregorovius (Friar) on Mar 27, 2002 at 17:11 UTC | |
by merlyn (Sage) on Mar 27, 2002 at 17:35 UTC |