Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I have an idea for a debugging program that might allow me to input a perl script, and it will print out the program substituting the variables with the current (at time of printing) values of each variable. It might also be cool if I set up some sort of trace function where it would actually print out the line of code (line being that seperated by ';') that is currently being utilized...and thus, it might do a couple of lines a couple of times for loops, and it would order sub routines as it needed to. I'm not too worried about writing this script for debugging of other scripts. But I'd like to do this as a subroutine for some of my programs -- so that it will actually do this to itself. My methodology for this is actually reading the perl script and executing the commands after it stores them temporarily into variables. My problem is that I'd be running this on itself, and before I attempt THAT, I think I'd like to make sure that I won't be causing any potential problems. Is there potential problems for a file reading itself to execute itself within itself? I would have a command line sub-command so that I wouldn't end up with a continuous loop.

Is there perhaps a better way to have a script output itself during execution time while also replacing variables with their actual values?

--Coplan


In reply to Ultimate Debugging: by Coplan

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2023-10-04 13:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?