On 2012-01-23, at 10:40 AM, Galen Charlton wrote:
Hi,
On Jan 21, 2012, at 11:40 PM, Chris Cormack wrote:
* Mason James (mtj@kohaaloha.com) wrote:
hmmm, shall we start wrapping the loading of Koha debug modules in a 'if ($DEBUG) {use Smart::Comments}' type code block - as a performance tweak?
would that work?
No because the use is called anyway, you can conditionally use a use call. You would need to do require and import.
_Cannot_ conditionally use a use call, I assume.
Mason: "use Foo;" is equivalent to
BEGIN { require Foo; import Foo; };
The implicit BEGIN block is why one can put a use call anywhere in the source file, including after code that makes use of the module one is use'ing.
aaah, yep - thats sounds very familiar to me :p hmmm, would using 'Module::Load::Conditional' be a nice clean way to conditionally load debug modules when needed? http://search.cpan.org/dist/Module-Load-Conditional/lib/Module/Load/Conditio...