List Info

Thread: expect perl module




expect perl module
country flaguser name
United States
2007-10-24 01:07:26

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(&quot;USAGE: $0 <host&gt; <user&gt; <pw>n");
exit(-1);
}

$host = shift;
$user = shift;
$pw = shift;

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

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

#
#--- LOGIN AND INTERACT !
----------------------------------------------------#
#
$exp-&gt;expect(10000, [ $prompt => sub { $_[0]->send(";$pwn"); } ]);
$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; rootnu-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
INC:
/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
.

__._,_.___
.

__,_._,___
Re: expect perl module
country flaguser name
United States
2007-10-24 01:16:56

Hi there list,

this appears to have started after the perl module IO::Stty was
installed via cpan

Cheers,

Noah

Noah wrote:
&gt;
>
> 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?
&gt;
> 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(&quot;USAGE: $0 <host&gt; <user&gt; <pw>n");
> exit(-1);
> }
>
> $host = shift;
&gt; $user = shift;
&gt; $pw = shift;
&gt;
> #
> #--- CONFIGURATION
> ------------ --------- --------- --------- --------- --------- -#
> #
> $cmd = "ssh -l $user $host";;
> $prompt = "[Pp]assword&quot; ;
>
> #
> #--- START SSH LOGIN SEQUENCE !
> ------------ --------- --------- --------- -------#
> #
> $exp = new Expect();
> $exp->raw_pty( 1);
> $exp->spawn( $cmd);
&gt;
> #
> #--- LOGIN AND INTERACT !
> ------------ --------- --------- --------- --------- ----#
&gt; #
> $exp->expect( 10000, [ $prompt => sub { $_[0]->send( "$pwn"); } ]);
> $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
&gt; uname='darwin macintosh-2. local 8.10.1 darwin kernel version
> 8.10.1: wed may 23 16:33:00 pdt 2007; rootnu-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
&gt; -Dman3dir=/sw/ lib/perl5- core/5.8. 8/man/man3 -Dman3ext=3pm -Duseithreads
> -Dinc_version_ list=5.8. 8/darwin- thread-multi- 2level
&gt; 5.8.6/darwin- thread-multi- 2level 5.8.1 5.8.0 5.6.0
&gt; -Adefine:startperl= #!/sw/bin/ perl5.8.8'
> hint=recommended, useposix=true, d_sigaction= define
&gt; usethreads=define use5005threads= undef useithreads= define
&gt; usemultiplicity= define
&gt; useperlio=define d_sfio=undef uselargefiles= define usesocks=undef
> use64bitint= undef use64bitall= undef uselongdouble= undef
&gt; usemymalloc= n, bincompat5005= undef
&gt; 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
&gt; 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
&gt; Compiled at Aug 9 2007 21:52:20
> INC:
>; /sw/lib/perl5- core/5.8. 8/darwin- thread-multi- 2level
&gt; /sw/lib/perl5- core/5.8. 8
> /sw/lib/perl5/ site_perl/ 5.8.8/darwin- thread-multi- 2level
&gt; /sw/lib/perl5/ site_perl/ 5.8.8
&gt; /sw/lib/perl5/ site_perl/ 5.8.8/darwin- thread-multi- 2level
&gt; /sw/lib/perl5/ site_perl
> .
>
>

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )