Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

That is an open ended question if ever I saw one. In short, yes it is worth learning the perl debugger.

One of the very cool features of the perl debugger, that you tend not to find in flashy GUI debuggers found in expensive IDEs for compiled languages is the ability to try out stuff, and evaluate bits of code to see what happens.

For example, earlier today, a foolish monk posted their homework question (or may been it was a test). Because I was mildly interested, I started the perl debugger by typing perl -demo into a handy shell prompt. (A trick I learnt here, I think from chromatic). This got me a perl shell into which I typed:

x \{ split /[:;]/, "1:one;2:two;3:three" }

This confirmed that I had the correct syntax for the solution. Quick and easy. No need to write a script, save it into a file and print the output.

The ability to evaluate expressions is even more powerful when you are working on a big program. Frequently when I am using DBIx::Class or HTML::TreeBuilder, I will set a breakpoint in the script. (Add the line DB::single=1), and then start evaluating expressions to see where they lead. Once I have something useful, I paste it into my editor and go from there. You can do the same with complex regular expressions.

There are plenty more tips on how to use the debugger. Many can be found here if you search.

The other useful tip, is that many of the more senior monks in this monastery often keep lots of useful links on their home nodes, so if you have some free time, head over to Saints in our Book, and start clicking through to home nodes and see what you find. You may strike gold.

In reply to Re: In the art of Perl Debugger Mastery, I seek enlightenment by chrestomanci
in thread In the art of Perl Debugger Mastery, I seek enlightenment by Tommy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (7)
    As of 2019-06-20 17:06 GMT
    Find Nodes?
      Voting Booth?
      Is there a future for codeless software?

      Results (90 votes). Check out past polls.