in reply to Re^2: Data Persistence
in thread Data Persistence
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Data Persistence
by ShaZe (Novice) on Nov 20, 2014 at 15:47 UTC | |
by Laurent_R (Canon) on Nov 20, 2014 at 23:27 UTC |