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

Re: globally seen vairable

by BrowserUk (Pope)
on Sep 28, 2010 at 16:28 UTC ( #862462=note: print w/ replies, xml ) Need Help??


in reply to globally seen vairable

What is a drawback of such a variable, say for multithreading,

If it is read-only. Ie. just conveying some piece of static information from the main program to the modules/threads, there is no significant problem.

If it is intended to act as a conduit for passing dynamic information back and forth between threads, then you would need to apply locking.

In general, there is no difference between obtaining a piece of static information from a global variable, and calling a (global) function (singleton instantiator) to obtain that information. Both involve the calling code "knowing" an well-known name.

Eg. $My::Config::DBhandle->somemethod( ... );

or My::Config->new()->get_DBHandle()->somemethod( ... );


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: globally seen vairable
Select or Download Code
Re^2: globally seen vairable
by k_manimuthu (Monk) on Sep 29, 2010 at 07:55 UTC

    You may use the "vars" module.

    See: use vars;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2015-07-05 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls