http://www.perlmonks.org?node_id=323904


in reply to Debug code out of production systems

I think that this is probably the most 'legitimate' use of a source filter I've seen. I really like that it turns the usual practice on it's head and only imposes additional overhead (minimal, compile-time) when enabled, whilst imposing none when disabled. Nice++

However, I am also a little dubious about the use of =begin as the trigger, and as the name of the module.

Whilst =begin DEBUGGING and =begin VERBOSE read quite nicely, and combining that with the requirement that the second word be all-uppercase makes it less likely that it will step on anyones toes, using what is a fairly common place word 'begin' as the trigger seems to invite the possibility that it will encounter a few modules containing a

=begin HERE Some dramaticly dangerously piece of (DON'T USE) example code:) =cut

It's a stretch, but using a less common, combined or made-up word might lessen the chances. The only (pathetic, cutesy) possibiliy that comes to mind is

=dBugin DEBUG

Aweful, but it demonstrates the idea that a made up word that lends itself to immediate association with debugging, is less likely to turn up by accident, and less likely to be overlooked by the unfamiliar.

I also think that as a module name, 'begin' is most unlikely to attract my attention, or turn up on my keyword searches of CPAN for a debugguging aid.

I really do like the implementation though -- and I will be making use of it.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Timing (and a little luck) are everything!

Replies are listed 'Best First'.
Re: Re: Debug code out of production systems
by liz (Monsignor) on Jan 25, 2004 at 10:02 UTC
    ...it will encounter a few modules containing a
    =begin HERE Some dramaticly dangerously piece of (DON'T USE) example code:) =cut

    For code to be included this way, it would have to be:

    • code, not some type of documentation. If it was some type of documentation, it would cause compilation errors.
    • the HERE or "all" feature must ba activated.
    I think that's a save stretch (famous last words ;-).

    I also think that as a module name, 'begin' is most unlikely to attract my attention, or turn up on my keyword searches of CPAN...

    Would "ifdef" have worked?

    Liz