Help: Debug perl codes

Discussion in 'Perl Misc' started by Amy Lee, Aug 17, 2008.

  1. Amy Lee

    Amy Lee Guest

    Hello,

    Is there any way to debug perl codes like shell script with "sh -x"?

    Thank you very much~

    Best Regards,

    Amy
     
    Amy Lee, Aug 17, 2008
    #1
    1. Advertising

  2. Amy Lee <> wrote:
    >Is there any way to debug perl codes like shell script with "sh -x"?


    Is there anything wrong with the answer to 'perldoc -q debug':
    How do I debug my Perl programs?

    jue
     
    Jürgen Exner, Aug 17, 2008
    #2
    1. Advertising

  3. Amy Lee <> wrote:


    > Is there any way to debug perl codes like shell script with "sh -x"?



    Please do not continue to use this newsgroup as a service
    that reads the docs to you.

    Make at least some small effort to answer your questions yourself
    before resorting to asking here.

    Have you seen the Posting Guidelines that are posted here frequently?


    perldoc -q debug

    How do I debug my Perl programs?


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad J McClellan, Aug 17, 2008
    #3
  4. Amy Lee

    Peter Scott Guest

    On Sun, 17 Aug 2008 12:52:11 +0000, Jürgen Exner wrote:
    > Amy Lee <> wrote:
    >>Is there any way to debug perl codes like shell script with "sh -x"?

    >
    > Is there anything wrong with the answer to 'perldoc -q debug':
    > How do I debug my Perl programs?


    Perhaps that it doesn't answer Amy's question? She wants:

    Devel::Trace Print out each line before it is executed (like sh -x)

    http://search.cpan.org/~mjd/Devel-Trace-0.10/

    --
    Peter Scott
    http://www.perlmedic.com/
    http://www.perldebugged.com/
     
    Peter Scott, Aug 17, 2008
    #4
  5. Peter Scott <> wrote:
    >On Sun, 17 Aug 2008 12:52:11 +0000, Jürgen Exner wrote:
    >> Amy Lee <> wrote:
    >>>Is there any way to debug perl codes like shell script with "sh -x"?

    >>
    >> Is there anything wrong with the answer to 'perldoc -q debug':
    >> How do I debug my Perl programs?

    >
    >Perhaps that it doesn't answer Amy's question? She wants:


    Fair enough.

    > Devel::Trace Print out each line before it is executed (like sh -x)


    Because 'sh' is not a Perl command if would have helped to explain what
    it does, just like you did in just half a sentence.

    jue
     
    Jürgen Exner, Aug 17, 2008
    #5
  6. Amy Lee

    Amy Lee Guest

    On Sun, 17 Aug 2008 13:39:03 +0000, Peter Scott wrote:

    > On Sun, 17 Aug 2008 12:52:11 +0000, Jürgen Exner wrote:
    >> Amy Lee <> wrote:
    >>>Is there any way to debug perl codes like shell script with "sh -x"?

    >>
    >> Is there anything wrong with the answer to 'perldoc -q debug':
    >> How do I debug my Perl programs?

    >
    > Perhaps that it doesn't answer Amy's question? She wants:
    >
    > Devel::Trace Print out each line before it is executed (like sh -x)
    >
    > http://search.cpan.org/~mjd/Devel-Trace-0.10/

    Thanks. I need this module to debug a script. Thanks to Jue~

    Amy
     
    Amy Lee, Aug 17, 2008
    #6
  7. Thrill5 wrote:
    > "Tad J McClellan" <> wrote:
    >> Please do not continue to use this newsgroup as a service
    >> that reads the docs to you.
    >>
    >> Make at least some small effort to answer your questions yourself
    >> before resorting to asking here.

    >
    > Or else what? You'll stop posting and we all wont be able to read your
    > rants anymore?
    >
    > Waahhhh!!!


    Don't mock. Many highly knowledgeable Perl programmers *have* stopped
    posting here -- to everyones loss -- because they've grown weary of
    answering the same questions ad nauseum and of self-righteous whiners
    throwing tantrums when they are told to RTFM.

    I'd rather lose them than Tad.

    -mjc
     
    Michael Carman, Aug 19, 2008
    #7
  8. Amy Lee

    Amy Lee Guest

    On Tue, 19 Aug 2008 20:47:26 -0400, Thrill5 wrote:

    >
    > "Michael Carman" <> wrote in message
    > news:Sfyqk.304706$yE1.66653@attbi_s21...
    >> Thrill5 wrote:
    >>> "Tad J McClellan" <> wrote:
    >>>> Please do not continue to use this newsgroup as a service
    >>>> that reads the docs to you.
    >>>>
    >>>> Make at least some small effort to answer your questions yourself
    >>>> before resorting to asking here.
    >>>
    >>> Or else what? You'll stop posting and we all wont be able to read your
    >>> rants anymore?
    >>>
    >>> Waahhhh!!!

    >>
    >> Don't mock. Many highly knowledgeable Perl programmers *have* stopped
    >> posting here -- to everyones loss -- because they've grown weary of
    >> answering the same questions ad nauseum and of self-righteous whiners
    >> throwing tantrums when they are told to RTFM.
    >>
    >> I'd rather lose them than Tad.
    >>
    >> -mjc

    > If everyone were to RTFM then there wouldn't be any need to post any
    > messages here in the first place. Everything about Perl is documented ad
    > nauseam and at least a couple hundred books published on the subject. This
    > is a public newsgroup where ANYONE can post a ANY question they want that is
    > related to Perl even if it is printed in the FUCKING MANUAL. If someone
    > thinks the question is STUPID, SHUT THE **** UP and don't REPLY. No one is
    > forcing anyone to answer any question. If your too think your too smart to
    > answer stupid questions, don't waste YOUR time, or my bandwidth with a "your
    > stupid because you didn't RTFM" answer. The only self-righteous douchbags
    > on this newsgroups are the "highly knowledgeable Perl programmers" replying
    > with RTFM.

    Actually speaking, I have read the manual before I post my problem. But I
    hope I can trace every sentence in my perl codes not just 'debug'.
    However, I suppose that someone really did as misunderstood.

    As I think, experts might more be patient to newbies, right?

    Regards,

    Amy
     
    Amy Lee, Aug 20, 2008
    #8
  9. Amy Lee <> writes:

    > As I think, experts might more be patient to newbies, right?


    In my experience, I've found that the experts here are *far* more
    patient and helpful than the whiners claim. Sadly, no matter how
    patient one is, or how many helpful fishing lessons one gives, there
    will inevitably be someone in the audience who feels entitled to a
    free fish dinner instead.

    I suggest you keep reading a while - you'll quickly get a good feel
    for who is helpful here, and who's a self-entitled crank. A good
    indication of the latter is a half-shouted rant about how useless the
    regulars are, like the one to which you responded. :)

    sherm--

    --
    My blog: http://shermspace.blogspot.com
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, Aug 20, 2008
    #9
  10. "Vernan R." <> writes:

    > Sherm Pendley wrote:
    >
    >> Sadly, no matter how patient one is, or how many helpful fishing
    >> lessons one gives, there will inevitably be someone in the
    >> audience who feels entitled to a free fish dinner instead.

    >
    > I don't understand your reasoning. If you are saying the OP
    > was seeking free fish, then you are clearly mistaken. If
    > you are saying he who corected those presuming the question
    > to be a FAQ, then you are also wrong.


    Please don't put words in my mouth - if I had meant to say either of
    those things, I would have. The OP's question was perfectly valid, not
    in the FAQ, and those who directed her to the FAQ were mistaken.

    There are a handful of people here who *did* demand answers that would
    have been *trivially* answered with the most cursory search in the
    docs. I'm not referring to the OP, but to those "defending" her
    question by carrying on about how "mean" the regulars are. They've
    behaved badly in the past, been slapped down for it, and now they're
    carrying a grudge. As I said, it's easy to see who they are, by simply
    watching the group for a while, and observing who tries to be helpful
    and who does nothing but complain.

    I don't think it's a problem that's endemic to this group, btw, just
    human nature. In my experience, whenever you get a large enough group
    of people together, there will inevitably be a few freeloaders and
    whiners among them.

    >> I suggest you keep reading a while - you'll quickly get a good feel
    >> for who is helpful here, and who's a self-entitled crank. A good
    >> indication of the latter is a half-shouted rant about how useless the
    >> regulars are, like the one to which you responded. :)

    >
    > I never got the impression anyone was attempting to say that
    > the "regulars", as you put it, are useless


    Did you *read* the rant she responded to? :)

    > instead of letting it be, you are defending the error?


    Of course not. What I take objection to is the popular notion among
    whiners (including the one to whom the OP had responded) that such
    things are intentional attacks. The picture that these people paint,
    of being irrationally "attacked" by regulars who "hate newbies," is
    nothing but a ridiculous caricature.

    sherm--

    --
    My blog: http://shermspace.blogspot.com
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, Aug 21, 2008
    #10
  11. "Thrill5" <> writes:

    > "Sherm Pendley" <> wrote in message
    > news:...
    >>
    >> Of course not. What I take objection to is the popular notion among
    >> whiners (including the one to whom the OP had responded) that such
    >> things are intentional attacks. The picture that these people paint,
    >> of being irrationally "attacked" by regulars who "hate newbies," is
    >> nothing but a ridiculous caricature.

    >
    > My "rant" was directed only to the bullies that like to ridicule
    > posters because *they think* someone asked a dumb question.


    Exactly my point. When regulars make mistakes, you describe them as
    "bullies" who "like to ridicule" people. You refuse to consider that
    it was an honest mistake brought about by misinterpreting the OP's
    question; instead, you whine and rant about a hidden agenda that
    exists only in your imagination.

    > was a valid one and the reply *quote*
    > *end quote* offers no help to anyone.


    I'm not saying it did. What I find offensive is your claim that it was
    a deliberate attack by someone who's just being a bully.

    > How does he know if the OP spent 2 hours
    > researching or spent none?


    Well, given that Tad's response was off the mark, it's pretty obvious
    that he *doesn't* know that 100%. Mistakes happen. *Your* mistake is
    assuming that his response was intentional bullying.

    > Why does it that matter anyway?


    Speaking for myself, I believe that being able to navigate reference
    material is the single most useful skill that a programmer can have,
    in any language. Operating systems, languages, and toolkits come and
    go, far too quickly for anyone to do more than absorb general concepts
    and principles; that makes it critical for a programmer to be able to
    look up the relevant details on an as-needed basis.

    So, when I answer someone's question with a reference to the docs, I
    do so because I believe it's helpful on two levels. First, there's the
    short-term help of answering their immediate question, and second, I
    think it's helpful to encourage the long-term development of what I
    consider to be a critical skill.

    I think that most of the regulars are thinking along similar lines,
    and trying to offer what we think is the most helpful advice we can
    give. Sometimes we fail in the attempt, and our advice isn't as
    helpful as it could be; but that's just a failure in execution, not
    evidence of ill intent.

    sherm--

    --
    My blog: http://shermspace.blogspot.com
    Cocoa programming in Perl: http://camelbones.sourceforge.net
     
    Sherm Pendley, Aug 21, 2008
    #11
  12. Amy Lee

    Ted Zlatanov Guest

    On Wed, 20 Aug 2008 20:58:34 -0400 "Thrill5" <> wrote:

    T> Isn't one of the great things about a newsgroup is that your CAN use
    T> this newsgroup as a service to read the docs for you?

    If you don't seek knowledge on your own, no amount of external help will
    make you a better programmer (or better at anything else).

    Ted
     
    Ted Zlatanov, Aug 21, 2008
    #12
  13. Thrill5 wrote:
    > There are no dumb questions, only dumb answers


    That was in grade school. There are plenty of dumb questions in the
    adult world.

    > Isn't one of the great things about a newsgroup is that your CAN use
    > this newsgroup as a service to read the docs for you?


    Hell, no! It's incredibly rude and selfish to expect someone to do that
    for you. Besides, if someone can't read the docs what makes you think
    they can read them when they're quoted?

    > How does he know if the OP spent 2 hours researching or spent none?


    Unless the OP tells us outright he can't. He can only make an educated
    guess. The less information the OP provides the more likely she is to be
    judged as having *not* tried to help herself first.

    > Why does it that matter anyway?


    It matters because it's human nature to want to help people who deserve
    it and to not want to be taken advantage of by people who don't.

    For the record, I've never seen anyone flamed when they post a question
    that follows this pattern:

    I want to do X. I googled for Y and read the Z page in perldoc, but
    couldn't find what I was looking for.

    Even if X is a blatant FAQ the answers are usually "that's in the
    perlfoo manpage" or maybe just "perldoc perlfoo." No-one says "RTFM"
    when the OP demonstrates that they made an effort, however cursory.

    -mjc
     
    Michael Carman, Aug 23, 2008
    #13
  14. Michael Carman <> wrote:
    > Thrill5 wrote:


    >> How does he know if the OP spent 2 hours researching or spent none?

    >
    > Unless the OP tells us outright he can't. He can only make an educated
    > guess. The less information the OP provides the more likely she is to be
    > judged as having *not* tried to help herself first.



    This OP has been here for quite some time, there is a history
    of previous behavior here.

    I clearly knee-jerked that she was asking a FAQ when she wasn't, but
    that was because she has trained me to expect that in her posts.

    I was feeling bad about the knee jerking at first, maybe she asked
    for fish previously only because she didn't know how to fish, and
    that it was no longer a problem...

    .... until she posted a FAQ contemporary with this very thread:

    http://groups.google.com/group/comp.lang.perl.misc/msg/265fc3649125bdab


    >> Why does it that matter anyway?

    >
    > It matters because it's human nature to want to help people who deserve
    > it and to not want to be taken advantage of by people who don't.



    I expect that the "poster of the trollish persuasion" knee-jerked
    on my motivation for the 1st part of my followup because it is not
    a regular participant here, and so did not know what to expect
    from this OP.

    The 1st part of my followup was clearly an aside anyway (that's
    why it was in [square brackets]).

    My reason for following up was actually the 2nd part.

    Past behavior indicated that she was missing out on several key
    ways of fishing for help with Perl.

    Current behavior indicated that she was missing out on several key
    ways of fishing for help with Perl, since she had missed out on
    "perldoc -q".

    And even future behavior (after my followup in this thread)
    indicated that she was missing out on several key
    ways of fishing for help with Perl.

    So my purpose was to point out (yet again) how to pick up on
    several key ways of fishing for help with Perl.


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad J McClellan, Aug 23, 2008
    #14
  15. Sherm Pendley, Aug 24, 2008
    #15
  16. On 2008-08-20 01:05, Amy Lee <> wrote:
    > Actually speaking, I have read the manual before I post my problem. But I
    > hope I can trace every sentence in my perl codes not just 'debug'.

    ^^^^^ ^^^^^

    Well, that's two keywords you could search for. And in fact, if you
    search for "trace" in "perldoc perldebug", you will discover AutoTrace,
    which is another answer to your question.

    hp
     
    Peter J. Holzer, Aug 24, 2008
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg  --
    Replies:
    4
    Views:
    2,171
  2. Replies:
    2
    Views:
    2,846
    Malcolm
    Aug 20, 2005
  3. Allen
    Replies:
    1
    Views:
    659
    Mark Rae [MVP]
    Dec 3, 2007
  4. Ali
    Replies:
    4
    Views:
    141
    pkent
    Mar 1, 2004
  5. Kelvin
    Replies:
    2
    Views:
    118
    Eric Bohlman
    Oct 22, 2004
Loading...

Share This Page