From owner-freebsd-questions@FreeBSD.ORG Wed Jul 30 06:43:14 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 146C337B401 for ; Wed, 30 Jul 2003 06:43:14 -0700 (PDT) Received: from mail.anderson.edu (puccini.anderson.edu [199.8.15.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 35B2843F3F for ; Wed, 30 Jul 2003 06:43:13 -0700 (PDT) (envelope-from ajaved@anderson.edu) Received: from DOM04-MTA by mail.anderson.edu with Novell_GroupWise; Wed, 30 Jul 2003 08:43:12 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.0.3 Date: Wed, 30 Jul 2003 08:42:51 -0500 From: "Alex Aved" To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: OT: Perl Expect Module X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2003 13:43:14 -0000 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