control other applications using perl

J

Joel Smith

I have a CD-ROM dictionary and the front end of the software that
extracts the definitions has been made so user-unfriendly that it's
practically faster to look the words up in a regular dictionary. what
i'd like to do is right a perl script that will take a list of words,
feed them into the application and and execute commands within the
application that are directed from the perl script. Is this possible?
Is there a module that does this? Any information would be greatly
appreciated.
 
J

Jürgen Exner

Joel said:
I have a CD-ROM dictionary and the front end of the software that
extracts the definitions has been made so user-unfriendly that it's
practically faster to look the words up in a regular dictionary. what
i'd like to do is right a perl script that will take a list of words,
feed them into the application and and execute commands within the
application that are directed from the perl script. Is this possible?
Is there a module that does this? Any information would be greatly
appreciated.

Are you looking for the Expect module?

jue
 
J

Joel Smith

Jürgen Exner said:
Are you looking for the Expect module?

jue

I used perl -MCPAN -e shell to install Expect. All went fine. I
wrote this script to

use Expect;

my $exp = Expect->spawn("xterm");
$exp->debug(1);
# $exp->send("ls\n");

and I receive the following

perl test.pl
Closing spawn id(3).
Expect::hard_close('Expect=GLOB(0x86d8f80)') called at
/usr/lib/perl5/site_perl/5.8.3/Expect.pm line 1575
Expect::DESTROY('Expect=GLOB(0x86d8f80)') called at test.pl line 0
eval {...} called at test.pl line 0
spawn id(3) closed.
Pid 3070 of spawn id(3) terminated, Status: 0x01

Is there something basic I'm missing?
 
K

knobo

Joel Smith said:
I used perl -MCPAN -e shell to install Expect. All went fine. I
wrote this script to

use Expect;

my $exp = Expect->spawn("xterm");
$exp->debug(1);
# $exp->send("ls\n");

and I receive the following

perl test.pl
Closing spawn id(3).
Expect::hard_close('Expect=GLOB(0x86d8f80)') called at
/usr/lib/perl5/site_perl/5.8.3/Expect.pm line 1575
Expect::DESTROY('Expect=GLOB(0x86d8f80)') called at test.pl line 0
eval {...} called at test.pl line 0
spawn id(3) closed.
Pid 3070 of spawn id(3) terminated, Status: 0x01

Is there something basic I'm missing?

xterm does not read from stdin, nor writes to stdout
my $exp = Expect->spawn("/bin/sh");
is probably what you whant
 

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
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top