Operating System - HP-UX
1822277 Members
3984 Online
109642 Solutions
New Discussion юеВ

Re: Alternate for expect.

 
SOLVED
Go to solution
ben_43
Frequent Advisor

Alternate for expect.

Team:

We use expect to automate Interactive installations. Are there any other products which would work on hp-ux other than expect? Please advise.

Thanks
Ben.
6 REPLIES 6
harry d brown jr
Honored Contributor

Re: Alternate for expect.


When you say "Interactive", is this a product or just the word "interactive" applied to installs, and if so, what kind of installs? Software, OS, ... ??

live free or die
harry
Live Free or Die
Mike Fisher_1
Frequent Advisor

Re: Alternate for expect.

Hi Ben

Are you asking:

"What's my choice of scripting languages within the HP-UX environment as an alternative to Expect?"

If so - what's your criteria?
Time flies like an arrow. Fruit flies prefer a banana.
H.Merijn Brand (procura
Honored Contributor

Re: Alternate for expect.

perl, what else :)

perl can be used to mimic Expect. If you want perl to behave pretty much like expect, there is a module available on CPAN, called ... tada ... Expect :)

http://search.cpan.org/author/RGIERSIG/Expect-1.15/

Expect::Simple is even more simple
http://search.cpan.org/author/DJERIUS/Expect-Simple-0.02/Simple.pm

use Expect::Simple;
my $obj = new Expect::Simple
{ Cmd => "dmcoords verbose=1 infile=$infile",
Prompt => [ -re => 'dmcoords>:\s+' ],
DisconnectCmd => 'q',
Verbose => 0,
Debug => 0,
Timeout => 100
};
$obj->send( $cmd );
print $obj->before;
print $obj->after;
print $obj->match_str, "\n";
print $obj->match_idx, "\n";
print $obj->error_expect;
print $obj->error;
$expect_object = $obj->expect_handle;
Enjoy, Have FUN! H.Merijn
ben_43
Frequent Advisor

Re: Alternate for expect.

Hi Procura:

Thanks. Yes i meant the word "Interactive".
Is this a wrapper or a perl module?

Thanks
Ben
H.Merijn Brand (procura
Honored Contributor
Solution

Re: Alternate for expect.

I don't know. I never used it, but I new it existed. http://search.cpan.org pointed me to the real names.

Any module/script in perl can be made interactive, just insert the right statements at the right points.

I don't know if it's a wrapper around the `real' expect, but knowing what kind of modules normally found on CPAN, I would guess it's just a re-implementation. It's not that hard to do using a few scattered select calls. Just read the readme. Start with Bundle::Expect:

--8<---
NAME
Bundle::Expect - Everything that Expect.pm needs

SYNOPSIS
perl -MCPAN -e 'install Bundle::Expect'

CONTENTS
Expect
IO::Stty
IO::Tty
IO::Pty

DESCRIPTION
Everything that Expect.pm needs. What can I say more?

AUTHOR
Roland Giersig
-->8---

Expect.pm v1.14
===============
Expect requires the latest version of IO::Tty, also available from
CPAN. IO::Stty has become optional but I'd suggest you also install
it. If you use the highly recommended CPAN module, there is a
Bundle::Expect available that installs everything for you.
If you prefer manual installation, the usual
perl Makefile.PL
make
make test
make install
should work. I finally started a testsuite for Expect, but it doesn't
really test anything deeper right now. The problem is to find some
external program to use for generating reproducible output that is
available across all platforms. Luckily, we can always use perl
itself... Contributions to the testsuite are of course welcome.
Note that IO::Tty is very system-dependend. It has been extensively
reworked and tested, but there still may be systems that have
problems.
The Perl Expect module was inspired more by the functionality of
Tcl/Expect than any previous Expect-like tool such as Comm.pl or
chat2.pl.
The Tcl version of Expect is a creation of Don Libes (libes@nist.gov)
and can be found at http://expect.nist.gov/. Don has written an
excellent in-depth tutorial of Tcl/Expect, which is _Exploring
Expect_. It is the O'Reilly book with the monkey on the front. Don
has several references to other articles on the Expect web page.
I try to stay as close to Tcl/Expect in interface and semantics as
possible (so I can refer questions to the Tcl/Expect docu).
Suggestions for improvement are always welcome.
[Latest rumours have it that Don plans a rewrite of Expect as a
stand-alone library that can be easily embedded into various scripting
languages.]
There is now a FAQ section in the pod, complete with examples, so
please let me know if there's something you'd like to see answered
there that isn't.
There are two mailing lists available, expectperl-announce and
expectperl-discuss, at
http://lists.sourceforge.net/lists/listinfo/expectperl-announce
and
http://lists.sourceforge.net/lists/listinfo/expectperl-discuss
Enjoy, Have FUN! H.Merijn
John Meissner
Esteemed Contributor

Re: Alternate for expect.

Ben - does expect work? if so why fix it if it isn't broken?

I use expect for several scripts at work. I personally don't know of another program to replace it. I know that (Red Hat) Linux uses kickstart to automate system installs. I am not aware of anything HP has to do the same though.
All paths lead to destiny