Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^5: Module for Printing Line Numbers in Debug?

by LanX (Chancellor)
on Jan 21, 2013 at 14:45 UTC ( #1014454=note: print w/ replies, xml ) Need Help??

in reply to Re^4: Module for Printing Line Numbers in Debug?
in thread Module for Printing Line Numbers in Debug?

> A good idea, I was hoping for something even cleaner, that won't show up in production code by mistake.

It doesn't look like you will pass any arguments to log(), caller seems to provide anything you are looking for.

If you later check for production environment and set

sub log {}
then it will be optimized and not appear in the opcodes.

If you are still worried, use a name you can easily find and delete, like __LOG__, even a source filter doing this should be very safe.

But please search the archives for older discussions, this is certainly not the first one.

Cheers Rolf


) or even better, use Damian's approach from Smart::Comments and use a source filter only in testing mode to enable log() by deleting the '#' with s/;#LOG/;LOG;/g

s/a/b/ ;#LOG

Comment on Re^5: Module for Printing Line Numbers in Debug?
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014454]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2015-11-25 16:35 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (683 votes), past polls