Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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 $$;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://280677]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2017-03-25 20:32 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.