Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > expect perl mod...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 1006 of 1056
Post > Topic >>

expect perl module

by admin2@[EMAIL PROTECTED] (Noah) Oct 23, 2007 at 11:07 PM

Hi,


So I am having a little bit of trouble with the expect module when
formatting the output.  It is creating too many spaces and offsetting
the next printed/displayed line by 9 characters.  I am not quite sure
why - or how to correct the problem.

this is happening on the local machine.  I am using iTerm for Mac with
VT100 emulation configured.  any clues on this?

Here is the script and the machine's perl -V:


Macintosh-3:~ noahgarrettwallach$ less login.pl
#!/sw/bin/perl
#

use Expect;

#
#--- ENSURE TO HAVE SUFFICIENT COMMAND LINE ARGUMENTS ! 
----------------------#
#
if ( $#ARGV != 2 ) {
     printf("USAGE: $0 <host> <user> <pw>\n");
     exit(-1);
}

$host = ****ft;
$user = ****ft;
$pw   = ****ft;

#
#--- CONFIGURATION 
-----------------------------------------------------------#
#
$cmd    = "ssh -l $user $host";
$prompt = "[Pp]assword";

#
#--- START SSH LOGIN SEQUENCE ! 
----------------------------------------------#
#
$exp = new Expect();
$exp->raw_pty(1);
$exp->spawn($cmd);

#
#--- LOGIN AND INTERACT ! 
----------------------------------------------------#
#
$exp->expect(10000, [ $prompt => sub { $_[0]->send("$pw\n"); } ]);
$exp->interact();




Macintosh-3:~ noahgarrettwallach$ /sw/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
   Platform:
     osname=darwin, osvers=8.10.1, archname=darwin-thread-multi-2level
     uname='darwin macintosh-2.local 8.10.1 darwin kernel version
8.10.1: wed may 23 16:33:00 pdt 2007; root:xnu-792.22.5~1release_i386
i386 i386 '
     config_args='-des -Dcc=gcc -Dcpp=gcc -E -Dprefix=/sw
-Dccflags=-I/sw/include -Dldflags=-L/sw/lib -Dperladmin=none
-Uinstallusrbinperl -Dprivlib=/sw/lib/perl5-core/5.8.8
-Darchlib=/sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
-Dman3dir=/sw/lib/perl5-core/5.8.8/man/man3 -Dman3ext=3pm -Duseithreads
-Dinc_version_list=5.8.8/darwin-thread-multi-2level
5.8.6/darwin-thread-multi-2level 5.8.1 5.8.0 5.6.0
-Adefine:startperl=#!/sw/bin/perl5.8.8'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='gcc', ccflags ='-I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include -I/opt/local/include',
     optimize='-O3',
     cppflags='-no-cpp-precomp -I/sw/include -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include -I/opt/local/include'
     ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5367)',
gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/sw/lib
-L/usr/local/lib -L/opt/local/lib'
     libpth=/usr/local/lib /opt/local/lib /usr/lib
     libs=-ldbm -ldl -lm -lc
     perllibs=-ldl -lm -lc
     libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false,
libperl=libperl.a
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags='-L/sw/lib -bundle -undefined
dynamic_lookup -L/usr/local/lib -L/opt/local/lib'


Characteristics of this binary (from libperl):
   Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                         PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
                         USE_PERLIO USE_REENTRANT_API
   Built under darwin
   Compiled at Aug  9 2007 21:52:20
   @[EMAIL PROTECTED]
     /sw/lib/perl5-core/5.8.8/darwin-thread-multi-2level
     /sw/lib/perl5-core/5.8.8
     /sw/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
     /sw/lib/perl5/site_perl/5.8.8
     /sw/lib/perl5/site_perl/5.8.8/darwin-thread-multi-2level
     /sw/lib/perl5/site_perl
     .
 




 2 Posts in Topic:
expect perl module
admin2@[EMAIL PROTECTED]   2007-10-23 23:07:09 
Re: expect perl module
admin2@[EMAIL PROTECTED]   2007-10-23 23:16:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 23:40:09 CDT 2008.