E
Eric
Hello,
I'm not sure if this is a Perl question or an Expect question. But I
will start here.
I have written an Expect script that someone else is executing in
their Perl script. I would like my Expect script to return a string as
a value to this Perl script, not a boolean (i.e. integer).
For example, say my Expect script does something like this:
if (<this>) {
return "SUCCESS";
} else {
return "FAILURE";
}
The Perl script needs to have the value returned as either a "SUCCESS"
or "FAILURE".
I created a short Perl script that executes the Expect script by doing
the following:
my $rtnval = `rem.exp`;
Of course, that's not going to return the value I am looking for; it's
only going to print the output to stdout. And if I try:
my $rtnval = system("rem.exp");
that's only going to tell me if the system call passed or failed (i.e.
an integer), regardless of whether the Expect script deemed a success
or fail.
How can I call an Expect script from a Perl script and return a string
value? Is there some trick to getting an interaction between Perl and
Expect? I suppose I could do some kludge, like read the output into a
file and search the file for the response. But I'd rather avoid that
if possible.
Thanks in advance to all that respond.
Eric
I'm not sure if this is a Perl question or an Expect question. But I
will start here.
I have written an Expect script that someone else is executing in
their Perl script. I would like my Expect script to return a string as
a value to this Perl script, not a boolean (i.e. integer).
For example, say my Expect script does something like this:
if (<this>) {
return "SUCCESS";
} else {
return "FAILURE";
}
The Perl script needs to have the value returned as either a "SUCCESS"
or "FAILURE".
I created a short Perl script that executes the Expect script by doing
the following:
my $rtnval = `rem.exp`;
Of course, that's not going to return the value I am looking for; it's
only going to print the output to stdout. And if I try:
my $rtnval = system("rem.exp");
that's only going to tell me if the system call passed or failed (i.e.
an integer), regardless of whether the Expect script deemed a success
or fail.
How can I call an Expect script from a Perl script and return a string
value? Is there some trick to getting an interaction between Perl and
Expect? I suppose I could do some kludge, like read the output into a
file and search the file for the response. But I'd rather avoid that
if possible.
Thanks in advance to all that respond.
Eric