Date: Wed, 30 Jul 2003 08:42:51 -0500 From: "Alex Aved" <ajaved@anderson.edu> To: <freebsd-questions@freebsd.org> Subject: OT: Perl Expect Module Message-ID: <sf278520.089@mail.anderson.edu>
next in thread | raw e-mail | index | archive | help
Fellow listers,
I'm having trouble getting the Expect-1.15 perl module to work (FreeBSD =
4.8). What I'm trying to do is to query a dhcp server & given an IP =
address, return the MAC address using omshell (ISC; www.isc.org). I don't =
know Perl well enough to interpret where exactly it's failing.
Here's the script I'm trying to run:
>>>>>
use Expect;
use Data::Dumper;
$Expect::Log_Stdout =3D 1;
my $con =3D Expect->spawn("/usr/bin/omshell");
$con->debug(1);
$con->send("key defomapi \"secret_key_here\"\n");
$con->send("server _server_ip_here_\nport 7911\n");
$con->send("connect\n");
sleep(1);
$con->send("new lease\nset ip-address =3D 10.200.0.6\n");
sleep(1);
$con->send("open\n");
print "$con->expect(4, 'hardware-address =3D ')";
<<<<<
And here's the output when I try to run it interactively:
>>>>>
tallis# perl
use Expect;
use Data::Dumper;
$Expect::Log_Stdout =3D 1;
my $con =3D Expect->spawn("/usr/bin/omshell");
$con->debug(1);
$con->send("key defomapi \"secret_key_here\"\n");
$con->send("server _server_ip_here_\nport 7911\n");
$con->send("connect\n");
sleep(1);
$con->send("new lease\nset ip-address =3D 10.200.0.6\n");
sleep(1);
$con->send("open\n");
print "$con->expect(4, 'hardware-address =3D ')";
Closing spawn id(3).
Expect::hard_close('Expect=3DGLOB(0x8114078)') called at /usr/local=
/lib/perl5/site_perl/5.8.0/Expect.pm line 1575
Expect::DESTROY('Expect=3DGLOB(0x8114078)') called at - line 0
eval {...} called at - line 0
spawn id(3) closed.
Pid 13079 of spawn id(3) terminated, Status: 0x01
Expect=3DGLOB(0x8114078)->expect(4, 'hardware-address =3D ')
tallis#
<<<<<
Any help would be much appreciated!
Thanks,
--alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?sf278520.089>
