How to dump all (lexical) variables?

Discussion in 'Perl Misc' started by kj, Sep 29, 2009.

  1. kj

    kj Guest

    I have a long-running program that fails sporadically at a particular
    point in its execution. This is a "controlled failure", because
    it is due to an assertion that is unexpectedly failing to hold.
    To debug this, it would be really helpful if I could dump the values
    of all the current variables (especially the lexical ones that are
    "visible" at the point of failure) right before the program aborts.

    Is there an simple way to do this?

    TIA!

    kynn
    kj, Sep 29, 2009
    #1
    1. Advertising

  2. kj <> writes:

    > To debug this, it would be really helpful if I could dump the values
    > of all the current variables (especially the lexical ones that are
    > "visible" at the point of failure) right before the program aborts.


    The peek_my function from the PadWalker module might do what you want.

    //Makholm
    Peter Makholm, Sep 29, 2009
    #2
    1. Advertising

  3. kj

    kj Guest

    In <> Peter Makholm <> writes:

    >kj <> writes:


    >> To debug this, it would be really helpful if I could dump the values
    >> of all the current variables (especially the lexical ones that are
    >> "visible" at the point of failure) right before the program aborts.


    >The peek_my function from the PadWalker module might do what you want.


    Looks handy. Thanks!

    kynn
    kj, Sep 29, 2009
    #3
    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. halfdog
    Replies:
    12
    Views:
    12,415
  2. Joakim Hove

    Lexical variables - speed penalty?

    Joakim Hove, Oct 7, 2004, in forum: C Programming
    Replies:
    3
    Views:
    255
    CBFalconer
    Oct 7, 2004
  3. Joseph Ellis
    Replies:
    6
    Views:
    131
    Joseph Ellis
    Jul 25, 2003
  4. Peter J. Holzer

    Warning about unused lexical variables

    Peter J. Holzer, Sep 4, 2007, in forum: Perl Misc
    Replies:
    5
    Views:
    158
    Peter J. Holzer
    Sep 7, 2007
  5. okey

    lexical dump?

    okey, Apr 3, 2009, in forum: Perl Misc
    Replies:
    1
    Views:
    87
Loading...

Share This Page