I called it Singleton to have a name for something where exactly one instance exists. How you want to implement this is a matter of taste.
IMHO you should use a packages function or a class' method to access this variable. As soon as you let it access from the outside of the package you don't have control over who changes what when. That makes concurrency hard. If you don't have concurrency than so what. But there is always also the requirement of testing which makes it feasible to encapsulate.
Be careful: use is (besides importing) a require at compile time. But a require is also just done once for a module. Have a look at perldoc -f require.
McA
In reply to Re^3: Data Persistence
by McA
in thread Data Persistence
by ShaZe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |