[Koha-devel] add the Smart::Comments perl module to Koha, a good idea?
Mason James
mtj at kohaaloha.com
Mon Jan 23 03:22:33 CET 2012
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 at 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/Conditional.pm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 535 bytes
Desc: This is a digitally signed message part
URL: </pipermail/koha-devel/attachments/20120123/591c793a/attachment.pgp>
More information about the Koha-devel
mailing list