Running Perl script in TCL script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running Perl script in TCL script
# 1  
Old 02-18-2009
Running Perl script in TCL script

Hi, experts,

I wonder if anyone can help me up with this. Has been googling and reading several books but still come to no idea how this can be done. Well, it's like this. I have a bundle of codes developed in Perl. I need to do something like this:
1. perl script run using spawn
2. in between, there'll be messages print out to terminal, but I want to capture these messages into a variable (I don't want it to appear in the terminal).
3. A default selection will be sent to perl script.
4. Process 2-3 will continue until there's no more prompt to the terminal.

So far, I am only able to trap the first message and the perl script would not proceed to the next prompt. Here's my script:

#!/usr/bin/tcl -f
package require Expect
spawn myscript
log_user 0

expect "\r"

set savedoutput $expect_out(buffer)
# puts $savedoutput
expect "name?"
send -- "1\r"

--> don't know how to proceed from here Smilie

exit 0

# content of myscript:
#!/usr/local/bin/perl
#print "hello, what's your name?\n";
#print "1. Sally\n2. Caroline\n3. Anthony\n";
#$name = <STDIN>;
#print "Now, tell me your age:\n";
#print "1. 10-19\n2. 20-29\n3. 30-39\n";
#$age = <STDIN>;

Any idea of how this can me done?

Regards,
dniz
# 2  
Old 02-18-2009
ask on PerlMonks - The Monastery Gates if you get no suggestions here, or find a tcl forum that can maybe help. I have no idea how to do what you are asking.
# 3  
Old 02-19-2009
Quote:
Originally Posted by KevinADC
ask on PerlMonks - The Monastery Gates if you get no suggestions here, or find a tcl forum that can maybe help. I have no idea how to do what you are asking.
I'm searching for a more resourceful forum now... so many forums listed. Any recommendation which are the more popular ones? Oh, and thanks anyway for the suggestion... Smilie
# 4  
Old 02-19-2009
For perl, PerlMonks - The Monastery Gates is the best perl forum. For tcl I have no idea.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script running multiple commands at once

Hi All, I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker. You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
Discussion started by: mutley2202
7 Replies

2. Windows & DOS: Issues & Discussions

PERL: Running script from Notepad++

I'm not sure if this forum covers PERL issues but here I go: I'm trying to run a PERL script from Notepadd++. I've entered the path of the script from the run command but it is only opening a blank window. Is there anything else that needs to be done when using the 'RUN' feature of Notepad++? (2 Replies)
Discussion started by: millsy5
2 Replies

3. Shell Programming and Scripting

Running one Perl script from another

Hi, I have one small question - what is the best way to run one perl script from another? Thanks in advance. (1 Reply)
Discussion started by: xqwzts
1 Replies

4. Shell Programming and Scripting

TCL script in PERL

Hi all, I am trying to run a tcl script in a perl script. Now my problem is when I run the tcl script from the perl script it runs very slowly but when I run the tcl script individually it is running at expected speed. What could be the problem?? Help please!!!! Thanks (0 Replies)
Discussion started by: mirock
0 Replies

5. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

6. UNIX for Advanced & Expert Users

What script is running by Perl?

Dear fellow unixoids! I need a little help (just a link would be fine) how can I investigate what specific perl script is eating 100% of cpu of my ubuntu server: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ... (2 Replies)
Discussion started by: ulrith
2 Replies

7. Shell Programming and Scripting

Running unix commands in a perl script

Executing two unix commads via perl script one after another e.g: make clean bsub -i -q short make have tried using exec but the second command doesnt executes (1 Reply)
Discussion started by: rajroshan
1 Replies

8. Shell Programming and Scripting

running perl script problem

While executing perl scriptit gives some compling issue, please help out $inputFilename="c:\allways.pl"; open (FILEH,$inputFilename) or die "Could not open log file"; Error : Could not open log file at c:\allways.pl line 4 learner in Perl (1 Reply)
Discussion started by: allways4u21
1 Replies

9. Shell Programming and Scripting

running egrep in perl script ?

Hi there if i run this from the BASH command line, i get a good result # FS="my-box23/account" # zfs list -t filesystem -H | cut -f1 |egrep "^ZPpool1/$FS$" ZP0pool1/my-box23/account which is great, however if I try to run in a perl script populating an array with the result/s, i get... (4 Replies)
Discussion started by: rethink
4 Replies

10. Shell Programming and Scripting

Running a remote Server through perl script

Hello people, I am want to run a server on remote machine through perl scripting using telnet api. Now when I try to do so, the server gets started perfectly, but as soon as I close the telnet connection in the script, the server started on the remote machine suddenly goes down. I also... (0 Replies)
Discussion started by: chandrak
0 Replies
Login or Register to Ask a Question