Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: use warnings and debug messages ( caller(expr) )

by LanX (Cardinal)
on Mar 08, 2017 at 01:50 UTC ( #1183906=note: print w/replies, xml ) Need Help??


in reply to Re^4: use warnings and debug messages
in thread use warnings and debug messages

Hi Gabor

> a runtime impact we need to consider

No need to read the source lines from file.

caller(EXPR) gives you the subs name already as 4th return value.

See caller for details.

update

never mind, I just realized that you still want to parse the code where the call happens, because the error happens in the args-list there debug("x=$x y=$y");

That's pretty much as stable as a source filter.

Why not relying on Smart::Comments then?

YMMV

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2020-07-10 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?