RE: Totally lost - need a starting point




----- 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:
----- 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
works
fine. I need to find a way to call the expect script and output the
perl

What perl?


to the html page that is calling it. I found a version of expect for
perl, but
it didn't seem to be able to get the results that I was looking for,
being
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>


Thanks for the information and the routine for this group.

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

.



Relevant Pages

  • 2005-10-23 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)
  • 2005-10-23 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)
  • 2005-10-23 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)
  • 2005-11-20 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)
  • 2005-11-20 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)