in reply to Basic debugging checklist
Hi toolic
Nice work, but may I suggest that
> Display the contents of variables using print or warn
> warn "$var\n";
is changed to
warn "<$var>";
?
Two reasons:
- I don't see the point of disabling line and file information from warn by default by appending "\n".
A beginner might get lost where the error originates.
- A missing chomp is very common, surrounding brackets <...> helps finding them.
A beginner should be made aware if his variable ends on a newline.
C:\>perl $var = "abc\n"; # trailing newline warn "$var\n"; warn "<$var>"; warn "$var"; __END__ abc <abc > at - line 4. abc
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery
update
I just realized that your point 3 covers chomp and detecting whitespace, but I'm still not sure why you're disabling the line info in warn.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Basic debugging checklist
by Athanasius (Archbishop) on Dec 03, 2017 at 15:08 UTC | |
Re^2: Basic debugging checklist
by davies (Prior) on Mar 01, 2020 at 22:14 UTC | |
by LanX (Saint) on Mar 01, 2020 at 23:57 UTC | |
by hippo (Bishop) on Mar 02, 2020 at 09:22 UTC | |
Re^2: Basic debugging checklist
by soonix (Canon) on Dec 03, 2017 at 14:44 UTC | |
by QM (Parson) on Dec 05, 2017 at 12:02 UTC |
In Section
Tutorials