RE: Totally lost - need a starting point
- From: hrosseau@xxxxxxxxxx (Helen)
- Date: Thu, 31 Aug 2006 14:02:08 -0400
----- Original Message -----
From: "Mumia W." <mumia.w.18.spam+nospam@xxxxxxxxxxxxx>
To: "Beginners List" <beginners@xxxxxxxx>
Sent: Thursday, August 31, 2006 11:29 AM
Subject: [Bulk] Re: Totally lost - need a starting point
On 08/31/2006 08:24 AM, Helen wrote:works
----- Original Message -----
From: "Charles K. Clarkson" <cclarkson@xxxxxxxxxx>
To: <beginners@xxxxxxxx>
Sent: Wednesday, August 30, 2006 10:16 PM
Subject: [Bulk] RE: Totally lost - need a starting point
Helen wrote:
I am starting from scratch again reading the manual more
completely. I am just running out of time on my deadline.
Break down your task into small pieces and solve for
those pieces. The first piece I can see is running an Expect
script from a perl program. Do you know how to do that?
I have no idea what Expect is, but searching for
'expect' and 'perl' in Google revealed a perl module for
expect.
The other pieces of your problem might include getting
form values from an HTML form. CGI.pm can help with that.
HTH,
Charles K. Clarkson
Yes I have a perl script running inside of the expect script, which
perlfine. I need to find a way to call the expect script and output the
perl, but
What perl?
to the html page that is calling it. I found a version of expect for
beingit didn't seem to be able to get the results that I was looking for,
Thanks for the information and the routine for this group.able to telnet into a terminal and offer up passwords and such. then run
another perl script that was picked as an option.
Helen
Hello Helen. First, you're confusing me; please don't
top-post, and "[Bulk] RE:" should not have been added to the
subject line; tame your mail-reader.
Second, Expect.pm can do telnet:
use strict;
use warnings;
use Expect;
my $exp = Expect->spawn(telnet => qw(localhost 80))
or die ("Spawn failed: $!\n");
my $data = '';
my $tosend = q{GET / HTTP/1.1
Host: localhost
Connection: close
};
$exp->expect(4,
[ '^Escape char' => sub {
$exp->send($tosend);
}],
);
$exp->expect(4,
[ '^HTTP/1.1' => sub {
$data = $exp->match . $exp->after;
}],
);
$exp->soft_close;
print "----------------------------------\n";
print $data;
__END__
On my system, the output from my local web-server appears.
HTH
--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail: beginners-help@xxxxxxxx
<http://learn.perl.org/> <http://learn.perl.org/first-response>
I have written the expect scripts, which telnet into a terminal and then run
scripts writen by the OEM. The scripts test the condition of the
communication terminal. From all the researching that I have done in the
past weeks, many people have asked this same question and the answer is
never shown. I have been reading the tutorials and I am still not capable.
Helen
working example of an expect script called telenet_term_tu_status.exp
#! /usr/bin/expect
set terminal1 "192.168.128.100"
set username "username"
set passwd "password"
spawn telnet "$terminal1"
expect "Username: "
send "$username\r"
expect "Password: "
send "$passwd\r"
expect "MSV-> "
send "tu_status\r"
expect "MSV-> "
send "exit\r"
interact
.
- References:
- RE: Totally lost - need a starting point
- From: Charles K. Clarkson
- Re: [Bulk] RE: Totally lost - need a starting point
- From: Helen
- Re: Totally lost - need a starting point
- From: Mumia W.
- RE: Totally lost - need a starting point
- Prev by Date: Re: DBI::st=HASH(0x88f6520)
- Next by Date: what is wrong with my script
- Previous by thread: Re: Totally lost - need a starting point
- Next by thread: parsing special characters in perl
- Index(es):
Relevant Pages
|