![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Pre-caching large constantsby hossman (Prior) |
on Feb 08, 2002 at 22:21 UTC ( #144263=note: print w/replies, xml ) | Need Help?? |
I don't think SelfLoader or AutoLoader are really what he
wants here. They are designed for situations in which
the compilation of code is very expensive, and you don't
want to bother unless the code is needed.
In this case, it sounds like the code to populate the constants is relatively simple, and won't take long to compile, it just takes a while to run. This screams accessor to me. Instead of making these constants part of your 'public' API, make them internal, and write an accessor for them that initializes them the first time it calls, and returns them everytime after that:
In Section
Seekers of Perl Wisdom
|
|