How to "unread" STDIN?

K

KKramsch

In said:
Why do you think you need to unread STDIN?


I'm trying to understand a large (and poorly documented program)
by stepping through it using DB. In various places, the program
reads from <STDIN>. It would make my life a whole lot easier if
I didn't have to restart DB every time I wanted to affect what the
program reads from <STDIN>.

Karl
 
P

Peter Scott

I'm trying to understand a large (and poorly documented program)
by stepping through it using DB. In various places, the program
reads from <STDIN>. It would make my life a whole lot easier if
I didn't have to restart DB every time I wanted to affect what the
program reads from <STDIN>.

Step to the place the program reads from STDIN, and provided
it's a simple variable assignment like, say,

while (<STDIN>)

then step just past that statement and then put into the input
variable whatever you'd like it to have read instead, e.g.,

DB<1> $_ = "fnord\n"

And then continue.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top