in reply to Debug Macro

That looks like a good use for a solution with Module::Compile. The original source would be manipulated (via PPI or whatever) and a compiled version with DEBUG() calls replaced by print @_ if 1 would be written as a .pmc files.

The obvious drawback is that once enabled in a program run, the macros won't see runtime changes. But that's coherent with the desire to eliminate the overhead of function calls, since we suppose that the mechanism for recompiling macros at runtime would be as heavy or even worse.

That would make feasible to build constructs that worked for instance like use which is kind of a macro for

BEGIN { require $foo; $foo->import(@args); # if any args }

Hum. May be a good idea or not.

Replies are listed 'Best First'.
Re^2: Debug Macro
by Outaspace (Scribe) on Mar 27, 2007 at 21:14 UTC
    Hi,

    do you have any experience with Module::Compile ? I looked at it once, because precompiling Modules would be a great advantage , but I couldn't figure out who to use it. Do you have any example or a good web resource that I can look at? Would appreciate it a lot.

    Andre