Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: use warnings and debug messages

by salva (Canon)
on Mar 06, 2017 at 14:50 UTC ( [id://1183762]=note: print w/replies, xml ) Need Help??


in reply to use warnings and debug messages

I have used something similar to the following function in the past:
sub debug { warn join '', map $_ // '<undef>', @_, "\n"; } # and then... debug "x=", $x, " y=", $y;

Update: and sometimes also a -f variant:

sub debugf { my $fmt = shift; warn sprintf($fmt, map $_ // '<undef>', @_) . "\n"; } debugf "x=%s y=%s", $x, $y; # <-- always using %s!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-18 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found