How to make a ruby script listining for interactivity?

B

Bart Van bos

Hi folks,

I would like to know if I can make a ruby script interactive. I don't
mean using IRB, but I would like to be able to interact within my
scripts after I press a certain 'magic' key. So far I have been looking
into trap and signals, but I don't really find the thing I need.

For those who know/used TCL, I loved using package 'interactive'. This
package allowed me to 'pause' my scripts with <CTRL-P>, giving me a
command interpreter that allowed my to interact with me script. This is
very useful for debugging purposes, since it allows you to 'pause' your
script and check some variables, instances, etc... Pressing the magic
key <CTRL-P> again 'unpaused' the script and let it run further on.

Really good stuff for debugging complex things without using 'puts' and
'messing up' your nice coded scripts.

Any idea on how to get this done anyone?

Kind regards,
Bart
 
R

Rahul Kumar

Bart said:
Hi folks,

I would like to know if I can make a ruby script interactive. I don't
mean using IRB, but I would like to be able to interact within my
scripts after I press a certain 'magic' key. So far I have been looking
into trap and signals, but I don't really find the thing I need.

For those who know/used TCL, I loved using package 'interactive'. This
package allowed me to 'pause' my scripts with <CTRL-P>, giving me a
command interpreter that allowed my to interact with me script. This is
very useful for debugging purposes, since it allows you to 'pause' your
script and check some variables, instances, etc... Pressing the magic
key <CTRL-P> again 'unpaused' the script and let it run further on.
Kind regards,
Bart

Wow ! this sounds like just what i have sorely been wanting. I have
started trying out a multi-threaded approach and giving a prompt to the
user to interact, but that makes each script complex.

Do you have any details on this, perhaps we could do this in ruby. Do
you have any TCL source you could mail me, or link to (if on the web),
or attach to the thread. I would love to work on this.
I did think of trapping signals.
 
S

Sean O'Halpin

Hi folks,

I would like to know if I can make a ruby script interactive. I don't
mean using IRB, but I would like to be able to interact within my
scripts after I press a certain 'magic' key. So far I have been looking
into trap and signals, but I don't really find the thing I need.

For those who know/used TCL, I loved using package 'interactive'. This
package allowed me to 'pause' my scripts with <CTRL-P>, giving me a
command interpreter that allowed my to interact with me script. This is
very useful for debugging purposes, since it allows you to 'pause' your
script and check some variables, instances, etc... Pressing the magic
key <CTRL-P> again 'unpaused' the script and let it run further on.

Really good stuff for debugging complex things without using 'puts' and
'messing up' your nice coded scripts.

Any idea on how to get this done anyone?

You could try ruby-debug.

Quick intro here:
http://pivotallabs.com/users/chad/b...g-in-30-seconds-we-don-t-need-no-stinkin-gui-
Details here: http://bashdb.sourceforge.net/ruby-debug.html

Regards,
Sean
 

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

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top