Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Creating 'universal' instances of objects?

by smalhotra (Scribe)
on Aug 04, 2003 at 13:57 UTC ( #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 $$;


Comment on Re: Creating 'universal' instances of objects?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-09-18 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls