On 08/31/2006 08:24 AM, Helen wrote:
----- Original Message -----
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: <beginners@perl.org>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to