Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

RFC: Basic debugging checklist

by toolic (Bishop)
on Feb 18, 2009 at 19:00 UTC ( #744845=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    use diagnostics;
    
  2. or download this
    print "$var\n";
    print "@things\n";   # array with spaces between elements
    
  3. or download this
    chomp $var;
    print ":$var:\n";
    
  4. or download this
    print ":$_:", ord($_), "\n" for (split //, $str)
    
  5. or download this
    use Data::Dumper;
    print Dumper(\%hash);
    print Dumper($ref);
    
  6. or download this
    print ref $ref, "\n";
    
  7. or download this
    $ perl -MO=Deparse program.pl
    
  8. or download this
    open my $fh, '<', 'foo.txt' or die "can not open foo.txt: $!";
    
  9. or download this
    if (system $cmd) {
        print "Error: $? for command $cmd"
    ...
        print "Command $cmd is OK"
    }
    $out = `$cmd`; print $? if $?;
    
  10. or download this
    eval { do_something() }; warn $@ if $@;
    
  11. or download this
    # what the heck does /^\s+$/ mean?
    use YAPE::Regex::Explain;
    print YAPE::Regex::Explain->new('/^\s+$/')->explain();
    
  12. or download this
    use WWW::Mechanize;
    if ($mech->success()) { ... }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://744845]
Approved by mr_mischief
Front-paged by Tanktalus
help
Chatterbox?
[choroba]: last ambrus: 1 week ago :-(
[erix]: let's invade Hungary
[planetscape]: darn
[erix]: probably on holiday, the slacker
erix is reduced to use a BROWSER. (remember those?)
[Discipulus]: figuring.. i'm still just use the side pm chat..
[erix]: (all this while karls guitar gently weeps...)
[planetscape]: (invade Hungary)++ #I'm hungry
[stonecolddevin]: i went too far down the irc rabbithole to hook this back up there
[Discipulus]: .. yes erix until NodeReaper put jhon coltrane again

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2017-06-22 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (531 votes). Check out past polls.