Advertisements

tpurl wrote:
> Hi, I've searched for hours on how to do this to no avail. Any help I
> can get would be greatly appreciated!
>
> I would like to interact with a console app that expects you to log in,
> send it commands, and then log out. A typical session might look like
> I've heard that you can do something like this with the expect module,
> but I would rather not have to install it on the machine with which I'm
> working.

Why not? You'd be finished by now. You can simply install it in your
directory:

Advertisements

tpurl <> wrote:
> I've searched for hours on how to do this to no avail.

Did you search the Perl Frequently Asked Questions?

> I would like to interact with a console app that expects you to log in,
> send it commands, and then log out.

perldoc -q expect

How can I write expect in Perl?

> I've heard that you can do something like this with the expect module,

Oh.

> but I would rather not have to install it on the machine with which I'm
> working.

Why would you rather not have to install it on the machine with which
you're working?

> open(MYAPP, "|$myapp") or die "Cannot execute $myapp: $!";
> my @lines = <MYAPP>; # read the value returned from the getval command
> However, this just blows up in my face. Does anyone point me in the
> right direction on this one?

perldoc -q pipe

How can I open a pipe both to and from a command?

But that requires another module that you would probably
rather not install...

Thanks a lot for the help guys! "Administrative constraints" are
keeping me from installing the Expect module on the servers with which
I'm working. Thanks for pointing me in the direction of the pipe
module.

"tpurl" <> wrote in news:1141751530.757948.183100
@v46g2000cwv.googlegroups.com:
> Thanks a lot for the help guys! "Administrative constraints" are
> keeping me from installing the Expect module on the servers with which
> I'm working. Thanks for pointing me in the direction of the pipe
> module.
>

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!