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( ... );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: globally seen vairable
by k_manimuthu (Monk) on Sep 29, 2010 at 07:55 UTC |