Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Creating 'universal' instances of objects?

by smalhotra (Scribe)
on Aug 04, 2003 at 13:57 UTC ( [id://280677]=note: print w/replies, xml ) Need Help??


in reply to Creating 'universal' instances of objects?

A couple of points:
1. The "universal" object you are trying to create is called a "singleton" (correct me if I'm wrong). Search PM or google for more information. Or look at singleton.
2. Although 'use'ing the modules specifically makes it easier for you and anyone else who looks at your code to see what's coming from where you might try to use one package to handle all these for you. Example:
package MyApp; use Config; use Login; sub config { return $config_object } sub login { return $login_object } ## main script use MyApp; MyApp->config->do_something(); ## or my $config = MyApp->config(); $config->{do_something}
I hope this gives you an idea.

$will->code for @food or $$;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-26 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found