You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(26) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(5) |
Feb
(3) |
Mar
(11) |
Apr
(10) |
May
(2) |
Jun
(5) |
Jul
(13) |
Aug
(2) |
Sep
(3) |
Oct
(10) |
Nov
(18) |
Dec
(29) |
2002 |
Jan
(12) |
Feb
(14) |
Mar
(73) |
Apr
(28) |
May
(21) |
Jun
(39) |
Jul
(40) |
Aug
(42) |
Sep
(20) |
Oct
(4) |
Nov
(9) |
Dec
(18) |
2003 |
Jan
(2) |
Feb
(8) |
Mar
(6) |
Apr
(24) |
May
(24) |
Jun
(14) |
Jul
(16) |
Aug
(36) |
Sep
(34) |
Oct
(23) |
Nov
(4) |
Dec
(15) |
2004 |
Jan
(6) |
Feb
(13) |
Mar
(7) |
Apr
(5) |
May
(11) |
Jun
(5) |
Jul
(4) |
Aug
|
Sep
(2) |
Oct
(16) |
Nov
(4) |
Dec
(9) |
2005 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
(10) |
May
(5) |
Jun
(13) |
Jul
(3) |
Aug
|
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(9) |
2006 |
Jan
|
Feb
(10) |
Mar
(22) |
Apr
(14) |
May
(5) |
Jun
(4) |
Jul
(19) |
Aug
(7) |
Sep
(16) |
Oct
(4) |
Nov
(1) |
Dec
(16) |
2007 |
Jan
(17) |
Feb
|
Mar
(35) |
Apr
(5) |
May
(20) |
Jun
(11) |
Jul
(33) |
Aug
(3) |
Sep
(2) |
Oct
(11) |
Nov
(23) |
Dec
(5) |
2008 |
Jan
(10) |
Feb
(9) |
Mar
|
Apr
(6) |
May
(8) |
Jun
(7) |
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(20) |
2009 |
Jan
(8) |
Feb
(8) |
Mar
(3) |
Apr
(8) |
May
(2) |
Jun
(11) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(7) |
Dec
(4) |
2010 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(7) |
Aug
(3) |
Sep
(7) |
Oct
(2) |
Nov
(1) |
Dec
(4) |
2011 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(2) |
Jun
|
Jul
(6) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
(30) |
Apr
(10) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(12) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: John M. <ex...@h0...> - 2003-04-08 12:39:50
|
Could use some tips on how to handle/translate non-ascii char's. I am using Expect.pm v 1.15 perl, v5.6.1 running on a Solaris 8 box. I am using expect to log into Nortel switches and I want to gather the forwarding database and vlan info. When I simply telnet into a switch, I can see the terminal screen cleared and then get text that looks like: MAC Address Table Aging Time: [ 300 seconds ] Find an Address: [ 00-00-00-00-00-00 ] Fast Aging: [ Enabled ] 00-00-86-1D-BF-BF Port: 11 00-00-86-4D-68-D4 Port: 1 etc, BUT it's really one long line with lots of special char's in it. I've tried several things including adding the line $exp->raw_pty(1); but, so far, I've been disappointed. I'm wondering if I can get Expect, IO:Stty, and/or IO:Tty to send me text that's easier to parse. -- Thx John Mahoney ex...@h0... |
From: Christian G. <cg...@hq...> - 2003-03-29 01:05:05
|
> I'm working on building a relocatable self-contained "perl world" which > contains all the modules I need for my project, without relying on > whatever happens to be installed on the target machine. > > On Solaris 8, I am running into a problem, the symptom of which may be > familiar to the regular members of this list. I am failing right at test > 2, where "expect" is waiting for the output produced. No output seems to > be forthcoming, even though running the spawned process with "truss" > seems to indicate that output is being produced. I suspect some problem > with the pty related to the way I may be building perl. > > Has anyone observed this? It turns out that I compiled perl with the wrong value for "byteorder". How that came in there is a long story, but I do think it is a bug that a specific setting for "byteorder" in Policy.sh is ignored when "crosscompile" is defined... but it isn't an expectperl bug :) Sorry for the disturbance. -- cg |
From: Christian G. <cg...@hq...> - 2003-03-28 22:40:49
|
I'm working on building a relocatable self-contained "perl world" which contains all the modules I need for my project, without relying on whatever happens to be installed on the target machine. On Solaris 8, I am running into a problem, the symptom of which may be familiar to the regular members of this list. I am failing right at test 2, where "expect" is waiting for the output produced. No output seems to be forthcoming, even though running the spawned process with "truss" seems to indicate that output is being produced. I suspect some problem with the pty related to the way I may be building perl. Has anyone observed this? |
From: expect <ex...@ih...> - 2003-03-19 03:14:36
|
On Thu, 13 Mar 2003 13:43:55 -0000 "Kemp, Donald" <dk...@em...> wrote: > Hi, > I have a problem I do not understand ..... I am using Expect to interact > between a Router and a user. This router is accessed by telnetting to one > router and then using this router to Dial the second Router. Having connect > to the second router I then "interact" with it using the code below > (interact_code). One of the things that you can do when in this mode is to > "enable" a logging facility (ctlr-x l). If "logging" in NOT enabled, then > you see only one copy of what you type, i.e. if you typed "show" you see > "show". However if "logging" IS enabled then you see 2 copies of everything > you type, i.e. if you typed "show" you see "sshhooww". What I do not > understand is why? Answer to first question: (as root) perl -MCPAN -e 'install (Net::Telnet)' Then use Net::Telnet Answer to second question: yes Seriously, try the Net::Telnet package and detecting "NO CARRIER" is what expect does so well! hth > > Sub-Routine Interact > sub interact { > my $telnet = shift; > my $fh; > my $ec; > > $fh=IO::File->new; > $fh->fdopen(fileno(STDIN),"r"); > > my $outfile = new IO::File; > $outfile->IO::File::fdopen(STDOUT,'w'); > > while (1) { > my $in_object = Expect-> exp_init($fh); > my $out_object = Expect-> exp_init($outfile); > $out_object-> manual_stty(1); > if ($_logfile) { > $telnet-> set_group($out_object,$_logfile); > } > else { > $telnet-> set_group($out_object); > } > $in_object-> set_group($telnet); > $in_object-> set_seq($ConfigData::escape_character,undef); > $telnet-> manual_stty(1); > Expect::interconnect($telnet,$in_object); > $in_object -> set_group(undef); > > print $telnet " \010"; # make the next test work... > # if there is something waiting in > # the handle after we are writing > # some nonsense to it, > # it is not closed. :-) > if (Expect::test_handles(0,$telnet)) { > #print STDERR "\n*** CONNECTION CLOSED ***\n"; > last; # connection is closed, exit > # HEY, THIS REALLY WORKS!!! > } > > system "stty", '-icanon', 'eol', "\001"; > $char = getc; > system "stty", 'icanon', 'eol', '^@'; # ASCII null > print "\010 \010"; > if ($char eq '?' || $char eq 'h') { > &hotkey_help($telnet); > } > elsif ($char eq 'l') { > &logging($telnet); > } > elsif ($char eq 'q') { > last; > } > } > system "stty", 'sane'; # clean up; this can not hurt > } > > Sub-Routine Logging > sub logging { > my $telnet = shift; > my $logfilename = shift; > > if ($_logfilehandle) { > $telnet-> set_group(undef); > close $_logfilehandle; > print STDERR "\n*** Logging to $_logfilename disabled. > ***\n"; > undef($_logfile); > undef($_logfilename); > undef($_logfilehandle); > print $telnet "\r"; > return; > } > > if (!$logfilename) { > $_logfilename = sprintf "/tmp/log-%s-%s-%s",$routername, > &Perm::get_user_name, > &POSIX::strftime("%Y%m%d-%H:%M:%S",localtime(time)); > > # if it was defined but empty, use the default and don't > ask. > if (!defined($logfilename)) { > print STDERR "\n*** Log to which file? ". > "Enter file name or hit Enter to > accept". > "\n*** the default file name: > $_logfilename\n"; > my $input = <STDIN>; > chomp($input); > if ($input) { > $input =~ /^(.*?)$/; > $_logfilename = $1; > } > } > } > else { > $_logfilename = $logfilename; > } > > my $pid = fork(); > if ($pid > 0) { > waitpid(0,$pid); > select(undef, undef, undef, 0.25); # sleep for 1/4 > second > } > elsif ($pid == 0) { # create the log file as the real > user... > $EFFECTIVE_USER_ID = $REAL_USER_ID; > local (*F); > open F,">$_logfilename"; > close F; > chmod 0660,$_logfilename; > exit 1; > } > $_logfilehandle = new IO::File $_logfilename, > O_WRONLY|O_APPEND|O_CREAT; > > if (!$_logfilehandle) { > print STDERR "*** Can not log to $_logfilename,\n*** $!\n"; > return; > } > print STDERR "*** Logging to $_logfilename\n"; > $_logfile = Expect-> exp_init($_logfilehandle); > $_logfile-> manual_stty(1); > $telnet-> set_group($_logfilehandle); > $telnet-> log_group(1); > print $telnet "\r"; > } > > > A second query I have is when I terminate the connection to the second > router (issue "exit") the modem gives me "NO CARRIER", is it possible to > detect this in the "interact" sub-routine?? > > > Best Regards, > Donald.E.S.Kemp > AT&T Labs > Network Management Solutions, > Building 6000, Langstone Technology Park, > Langstone Road, Havant, Hampshire, > United Kingdom, > PO9 1SA > Phone: +44(0)23 9222 8424 > email: dk...@em... > > This message and any attachments to it contain confidential business > information exclusively intended for the recipients. Please do not forward > or distribute it to anyone else. If you have received this e-mail in error, > please call [+44 (0)23 92228424] to report the error and then delete this > message from your system. > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > -- "One morning I shot an elephant in my pajamas. How he got into my pajamas I'll never know." -- Grouch Marx 0Oo. Rick Hubbell RHu...@ih... http://iHubbell.com .oO0 |
From: <db...@CT...> - 2003-03-18 23:40:10
|
It could be alot of things. I'd reccomend a simpler approach for logging to eliminate complexity and numbers of things that might be suspect. You might give the built-in logging feature a whirl --I think it's $obj->log_file() or something. Hmm...terminal driver echo? Looks like you're forcing sane mode. Either that, or your fork code might be resulting in unexpected behaviour. If it were me, I'd try removing the fork code and open log file some other way (open (FH, ">>../../filename"); or something) and see if behaviour remains. Hope this helps, David Basham db...@ct... "Kemp, Donald" <dk...@em...> Sent by: To: "'exp...@li...'" exp...@li...urc <exp...@li...> eforge.net cc: Subject: [Expectperl-discuss] Strange problem when using "Expect::interconnect" 03/13/2003 08:43 AM Hi, I have a problem I do not understand ..... I am using Expect to interact between a Router and a user. This router is accessed by telnetting to one router and then using this router to Dial the second Router. Having connect to the second router I then "interact" with it using the code below (interact_code). One of the things that you can do when in this mode is to "enable" a logging facility (ctlr-x l). If "logging" in NOT enabled, then you see only one copy of what you type, i.e. if you typed "show" you see "show". However if "logging" IS enabled then you see 2 copies of everything you type, i.e. if you typed "show" you see "sshhooww". What I do not understand is why? Sub-Routine Interact sub interact { my $telnet = shift; my $fh; my $ec; $fh=IO::File->new; $fh->fdopen(fileno(STDIN),"r"); my $outfile = new IO::File; $outfile->IO::File::fdopen(STDOUT,'w'); while (1) { my $in_object = Expect-> exp_init($fh); my $out_object = Expect-> exp_init($outfile); $out_object-> manual_stty(1); if ($_logfile) { $telnet-> set_group($out_object,$_logfile); } else { $telnet-> set_group($out_object); } $in_object-> set_group($telnet); $in_object-> set_seq ($ConfigData::escape_character,undef); $telnet-> manual_stty(1); Expect::interconnect($telnet,$in_object); $in_object -> set_group(undef); print $telnet " \010"; # make the next test work... # if there is something waiting in # the handle after we are writing # some nonsense to it, # it is not closed. :-) if (Expect::test_handles(0,$telnet)) { #print STDERR "\n*** CONNECTION CLOSED ***\n"; last; # connection is closed, exit # HEY, THIS REALLY WORKS!!! } system "stty", '-icanon', 'eol', "\001"; $char = getc; system "stty", 'icanon', 'eol', '^@'; # ASCII null print "\010 \010"; if ($char eq '?' || $char eq 'h') { &hotkey_help($telnet); } elsif ($char eq 'l') { &logging($telnet); } elsif ($char eq 'q') { last; } } system "stty", 'sane'; # clean up; this can not hurt } Sub-Routine Logging sub logging { my $telnet = shift; my $logfilename = shift; if ($_logfilehandle) { $telnet-> set_group(undef); close $_logfilehandle; print STDERR "\n*** Logging to $_logfilename disabled. ***\n"; undef($_logfile); undef($_logfilename); undef($_logfilehandle); print $telnet "\r"; return; } if (!$logfilename) { $_logfilename = sprintf "/tmp/log-%s-%s-%s",$routername, &Perm::get_user_name, &POSIX::strftime ("%Y%m%d-%H:%M:%S",localtime(time)); # if it was defined but empty, use the default and don't ask. if (!defined($logfilename)) { print STDERR "\n*** Log to which file? ". "Enter file name or hit Enter to accept". "\n*** the default file name: $_logfilename\n"; my $input = <STDIN>; chomp($input); if ($input) { $input =~ /^(.*?)$/; $_logfilename = $1; } } } else { $_logfilename = $logfilename; } my $pid = fork(); if ($pid > 0) { waitpid(0,$pid); select(undef, undef, undef, 0.25); # sleep for 1/4 second } elsif ($pid == 0) { # create the log file as the real user... $EFFECTIVE_USER_ID = $REAL_USER_ID; local (*F); open F,">$_logfilename"; close F; chmod 0660,$_logfilename; exit 1; } $_logfilehandle = new IO::File $_logfilename, O_WRONLY|O_APPEND|O_CREAT; if (!$_logfilehandle) { print STDERR "*** Can not log to $_logfilename,\n*** $!\n"; return; } print STDERR "*** Logging to $_logfilename\n"; $_logfile = Expect-> exp_init($_logfilehandle); $_logfile-> manual_stty(1); $telnet-> set_group($_logfilehandle); $telnet-> log_group(1); print $telnet "\r"; } A second query I have is when I terminate the connection to the second router (issue "exit") the modem gives me "NO CARRIER", is it possible to detect this in the "interact" sub-routine?? Best Regards, Donald.E.S.Kemp AT&T Labs Network Management Solutions, Building 6000, Langstone Technology Park, Langstone Road, Havant, Hampshire, United Kingdom, PO9 1SA Phone: +44(0)23 9222 8424 email: dk...@em... This message and any attachments to it contain confidential business information exclusively intended for the recipients. Please do not forward or distribute it to anyone else. If you have received this e-mail in error, please call [+44 (0)23 92228424] to report the error and then delete this message from your system. ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: David B. <dav...@at...> - 2003-03-18 00:01:51
|
It's difficult to be absolute given the possibilities. I noticed your forcing sane mode . . But that might not be it since you only see it when you toggle logging. . . hmm..You might want to test the possibility that your fork code is involved. Might be causing unexpected behaviour. Should be an easy test. I'd try $telnet->log_file() or just use perl to open without forking and see if the behaviour remains. Might simplify the code. Also you could try examining running processes to see if something unusual is appearing when you notice the echoing. On Mon, 2003-03-17 at 16:40, db...@CT... wrote: > ----- Forwarded by David Basham/ctcnet on 03/17/2003 04:50 PM ----- > > "Kemp, Donald" <dk...@em...> > Sent by: To: > exp...@li...urc "'exp...@li...'" > eforge.net <exp...@li...> > cc: > Subject: [Expectperl-discuss] Strange problem > 03/13/2003 08:43 AM when using "Expect::interconnect" > > > > > > > Hi, > I have a problem I do not understand ..... I am using Expect to interact > between a Router and a user. This router is accessed by telnetting to one > router and then using this router to Dial the second Router. Having connect > to the second router I then "interact" with it using the code below > (interact_code). One of the things that you can do when in this mode is to > "enable" a logging facility (ctlr-x l). If "logging" in NOT enabled, then > you see only one copy of what you type, i.e. if you typed "show" you see > "show". However if "logging" IS enabled then you see 2 copies of everything > you type, i.e. if you typed "show" you see "sshhooww". What I do not > understand is why? > > Sub-Routine Interact > sub interact { > my $telnet = shift; > my $fh; > my $ec; > > $fh=IO::File->new; > $fh->fdopen(fileno(STDIN),"r"); > > my $outfile = new IO::File; > $outfile->IO::File::fdopen(STDOUT,'w'); > > while (1) { > my $in_object = Expect-> exp_init($fh); > my $out_object = Expect-> exp_init($outfile); > $out_object-> manual_stty(1); > if ($_logfile) { > $telnet-> set_group($out_object,$_logfile); > } > else { > $telnet-> set_group($out_object); > } > $in_object-> set_group($telnet); > $in_object-> set_seq > ($ConfigData::escape_character,undef); > $telnet-> manual_stty(1); > Expect::interconnect($telnet,$in_object); > $in_object -> set_group(undef); > > print $telnet " \010"; # make the next test > work... > # if there is something > waiting in > # the handle after we > are writing > # some nonsense to it, > # it is not closed. :-) > if (Expect::test_handles(0,$telnet)) { > #print STDERR "\n*** CONNECTION CLOSED > ***\n"; > last; # connection is > closed, exit > # HEY, THIS REALLY > WORKS!!! > } > > system "stty", '-icanon', 'eol', "\001"; > $char = getc; > system "stty", 'icanon', 'eol', '^@'; # ASCII > null > print "\010 \010"; > if ($char eq '?' || $char eq 'h') { > &hotkey_help($telnet); > } > elsif ($char eq 'l') { > &logging($telnet); > } > elsif ($char eq 'q') { > last; > } > } > system "stty", 'sane'; # clean up; this can > not hurt > } > > Sub-Routine Logging > sub logging { > my $telnet = shift; > my $logfilename = shift; > > if ($_logfilehandle) { > $telnet-> set_group(undef); > close $_logfilehandle; > print STDERR "\n*** Logging to $_logfilename disabled. > ***\n"; > undef($_logfile); > undef($_logfilename); > undef($_logfilehandle); > print $telnet "\r"; > return; > } > > if (!$logfilename) { > $_logfilename = sprintf > "/tmp/log-%s-%s-%s",$routername, > &Perm::get_user_name, > &POSIX::strftime > ("%Y%m%d-%H:%M:%S",localtime(time)); > > # if it was defined but empty, use the default and > don't > ask. > if (!defined($logfilename)) { > print STDERR "\n*** Log to which file? > ". > "Enter file name or hit > Enter to > accept". > "\n*** the default file > name: > $_logfilename\n"; > my $input = <STDIN>; > chomp($input); > if ($input) { > $input =~ /^(.*?)$/; > $_logfilename = $1; > } > } > } > else { > $_logfilename = $logfilename; > } > > my $pid = fork(); > if ($pid > 0) { > waitpid(0,$pid); > select(undef, undef, undef, 0.25); # sleep > for 1/4 > second > } > elsif ($pid == 0) { # create the log file > as the real > user... > $EFFECTIVE_USER_ID = $REAL_USER_ID; > local (*F); > open F,">$_logfilename"; > close F; > chmod 0660,$_logfilename; > exit 1; > } > $_logfilehandle = new IO::File $_logfilename, > O_WRONLY|O_APPEND|O_CREAT; > > if (!$_logfilehandle) { > print STDERR "*** Can not log to $_logfilename,\n*** > $!\n"; > return; > } > print STDERR "*** Logging to $_logfilename\n"; > $_logfile = Expect-> exp_init($_logfilehandle); > $_logfile-> manual_stty(1); > $telnet-> set_group($_logfilehandle); > $telnet-> log_group(1); > print $telnet "\r"; > } > > > A second query I have is when I terminate the connection to the second > router (issue "exit") the modem gives me "NO CARRIER", is it possible to > detect this in the "interact" sub-routine?? > > > Best Regards, > Donald.E.S.Kemp > AT&T Labs > Network Management Solutions, > Building 6000, Langstone Technology Park, > Langstone Road, Havant, Hampshire, > United Kingdom, > PO9 1SA > Phone: +44(0)23 9222 8424 > email: dk...@em... > > This message and any attachments to it contain confidential business > information exclusively intended for the recipients. Please do not forward > or distribute it to anyone else. If you have received this e-mail in error, > please call [+44 (0)23 92228424] to report the error and then delete this > message from your system. > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > |
From: Kemp, D. <dk...@em...> - 2003-03-13 13:44:11
|
Hi, I have a problem I do not understand ..... I am using Expect to interact between a Router and a user. This router is accessed by telnetting to one router and then using this router to Dial the second Router. Having connect to the second router I then "interact" with it using the code below (interact_code). One of the things that you can do when in this mode is to "enable" a logging facility (ctlr-x l). If "logging" in NOT enabled, then you see only one copy of what you type, i.e. if you typed "show" you see "show". However if "logging" IS enabled then you see 2 copies of everything you type, i.e. if you typed "show" you see "sshhooww". What I do not understand is why? Sub-Routine Interact sub interact { my $telnet = shift; my $fh; my $ec; $fh=IO::File->new; $fh->fdopen(fileno(STDIN),"r"); my $outfile = new IO::File; $outfile->IO::File::fdopen(STDOUT,'w'); while (1) { my $in_object = Expect-> exp_init($fh); my $out_object = Expect-> exp_init($outfile); $out_object-> manual_stty(1); if ($_logfile) { $telnet-> set_group($out_object,$_logfile); } else { $telnet-> set_group($out_object); } $in_object-> set_group($telnet); $in_object-> set_seq($ConfigData::escape_character,undef); $telnet-> manual_stty(1); Expect::interconnect($telnet,$in_object); $in_object -> set_group(undef); print $telnet " \010"; # make the next test work... # if there is something waiting in # the handle after we are writing # some nonsense to it, # it is not closed. :-) if (Expect::test_handles(0,$telnet)) { #print STDERR "\n*** CONNECTION CLOSED ***\n"; last; # connection is closed, exit # HEY, THIS REALLY WORKS!!! } system "stty", '-icanon', 'eol', "\001"; $char = getc; system "stty", 'icanon', 'eol', '^@'; # ASCII null print "\010 \010"; if ($char eq '?' || $char eq 'h') { &hotkey_help($telnet); } elsif ($char eq 'l') { &logging($telnet); } elsif ($char eq 'q') { last; } } system "stty", 'sane'; # clean up; this can not hurt } Sub-Routine Logging sub logging { my $telnet = shift; my $logfilename = shift; if ($_logfilehandle) { $telnet-> set_group(undef); close $_logfilehandle; print STDERR "\n*** Logging to $_logfilename disabled. ***\n"; undef($_logfile); undef($_logfilename); undef($_logfilehandle); print $telnet "\r"; return; } if (!$logfilename) { $_logfilename = sprintf "/tmp/log-%s-%s-%s",$routername, &Perm::get_user_name, &POSIX::strftime("%Y%m%d-%H:%M:%S",localtime(time)); # if it was defined but empty, use the default and don't ask. if (!defined($logfilename)) { print STDERR "\n*** Log to which file? ". "Enter file name or hit Enter to accept". "\n*** the default file name: $_logfilename\n"; my $input = <STDIN>; chomp($input); if ($input) { $input =~ /^(.*?)$/; $_logfilename = $1; } } } else { $_logfilename = $logfilename; } my $pid = fork(); if ($pid > 0) { waitpid(0,$pid); select(undef, undef, undef, 0.25); # sleep for 1/4 second } elsif ($pid == 0) { # create the log file as the real user... $EFFECTIVE_USER_ID = $REAL_USER_ID; local (*F); open F,">$_logfilename"; close F; chmod 0660,$_logfilename; exit 1; } $_logfilehandle = new IO::File $_logfilename, O_WRONLY|O_APPEND|O_CREAT; if (!$_logfilehandle) { print STDERR "*** Can not log to $_logfilename,\n*** $!\n"; return; } print STDERR "*** Logging to $_logfilename\n"; $_logfile = Expect-> exp_init($_logfilehandle); $_logfile-> manual_stty(1); $telnet-> set_group($_logfilehandle); $telnet-> log_group(1); print $telnet "\r"; } A second query I have is when I terminate the connection to the second router (issue "exit") the modem gives me "NO CARRIER", is it possible to detect this in the "interact" sub-routine?? Best Regards, Donald.E.S.Kemp AT&T Labs Network Management Solutions, Building 6000, Langstone Technology Park, Langstone Road, Havant, Hampshire, United Kingdom, PO9 1SA Phone: +44(0)23 9222 8424 email: dk...@em... This message and any attachments to it contain confidential business information exclusively intended for the recipients. Please do not forward or distribute it to anyone else. If you have received this e-mail in error, please call [+44 (0)23 92228424] to report the error and then delete this message from your system. |
From: <db...@CT...> - 2003-02-28 19:48:27
|
If you want to capture the output of our spawned process into an array, there's a couple of ways to do it. Here's the way I prefer as it resembles the Tcl/Expect structure of accomplishing the same thing. There's other ways to do the matching; this is just one way. This is an example of spawning an "ls -la" command from the cmd line, and dumping 'stdout' to an array, then printing the array later. You could obviously do whatever you wanted to the array after you have the output. Substitute 'ls -la' for whatever and this should work for you: #!/usr/local/bin/perl use Expect; #------------------------------------------------- # turn off logging to console. If you want to see # stdout then just set this value back to '1'. #------------------------------------------------- $Expect::Log_Stdout=0; #---------------- # spawn a process #---------------- $session = Expect->spawn("/usr/local/bin/ls -la"); #------------------------ # expect our input lines: #------------------------ $session->expect(10, #--------------------------------------------- # if we match a line of text (STDOUT) from the # spawned process, push it to an array and continue #--------------------------------------------- '-re', "([^\r\n]+)[\r\n]+", sub { push(@output, ($session->matchlist)[0]); exp_continue; }, ); #----------------------------------------------------- # At this point, all output form spawned command is in # @output array. Let's print out the contents #----------------------------------------------------- foreach $row (@output) { print "**$row**\n"; } Hope this helps, David Basham db...@ct... "Maraglia, Dominicx" <dom...@in...> To: "'exp...@li...'" Sent by: <exp...@li...> exp...@li...urc cc: eforge.net Subject: [Expectperl-discuss] Capturing process output with Expect.pm 02/28/2003 12:13 PM Hello, I am having difficutlies while using the expect module to "capture" the output of a program called from within my perl script. Briefly, all I would like to do is: 1) call an interactive (shell) program from within my perl script 2) pass the program keystrokes 3) capture the text of certain responses from the shell program, preferablly in an array, as the shell program will return several lines of output which need to be analyzed. 1 and 2 are not problem at all, but I can not figure out number 3. Here is an example of what I am doing: ($cfg = Expect->spawn("cfg")) || die "Couldn't spawn relcfg, $!"; unless ($cfg->expect(10,"Enter selection: ")) { die "Execution of relcfg failed, ".$rel_cfg>exp_error()."\n"; } print $cfg "2\r"; unless ($cfg->expect(10,"Enter selection: ")) { die "Execution of relcfg failed, ".$cfg>exp_error()."\n"; } print $cfg "1\r"; unless ($cfg->expect(10,"Enter selection: ")) { die "Execution of relcfg failed, ".$cfg>exp_error()."\n"; } print $cfg "1\r"; unless ($cfg->expect(10,"Use CHAP for discovery [y/N/q]? ")) { die "Execution of relcfg failed, ".$cfg>exp_error()."\n"; } $cfg->send("N\r"); After sending the "N\r" the shell program will search and return information to the terminal and then prompt the user to quit the program; I can easily send commands to exit the program, but how do I capture the information returned by the program? I have tried the following constructs, and various permuatation, to no avail. $cfg->expect(0); $targets = $cfg->before(); @targets = $rel_cfg->before(); Thanks, Dominic ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Maraglia, D. <dom...@in...> - 2003-02-28 17:14:09
|
Hello, I am having difficutlies while using the expect module to "capture" the output of a program called from within my perl script. Briefly, all I would like to do is: 1) call an interactive (shell) program from within my perl script 2) pass the program keystrokes 3) capture the text of certain responses from the shell program, preferablly in an array, as the shell program will return several lines of output which need to be analyzed. 1 and 2 are not problem at all, but I can not figure out number 3. Here is an example of what I am doing: ($cfg = Expect->spawn("cfg")) || die "Couldn't spawn relcfg, $!"; unless ($cfg->expect(10,"Enter selection: ")) { die "Execution of relcfg failed, ".$rel_cfg>exp_error()."\n"; } print $cfg "2\r"; unless ($cfg->expect(10,"Enter selection: ")) { die "Execution of relcfg failed, ".$cfg>exp_error()."\n"; } print $cfg "1\r"; unless ($cfg->expect(10,"Enter selection: ")) { die "Execution of relcfg failed, ".$cfg>exp_error()."\n"; } print $cfg "1\r"; unless ($cfg->expect(10,"Use CHAP for discovery [y/N/q]? ")) { die "Execution of relcfg failed, ".$cfg>exp_error()."\n"; } $cfg->send("N\r"); After sending the "N\r" the shell program will search and return information to the terminal and then prompt the user to quit the program; I can easily send commands to exit the program, but how do I capture the information returned by the program? I have tried the following constructs, and various permuatation, to no avail. $cfg->expect(0); $targets = $cfg->before(); @targets = $rel_cfg->before(); Thanks, Dominic |
From: <db...@CT...> - 2003-02-19 15:45:52
|
Personally I have always run into stability issues when moving compiles like this around to different boxes. Something slightly different in the environments of the two boxes may cause this compile to 'misbehave', even if you were to figure this particular issue out. A fresh installation of perl (better yet a fresh compile from source) of perl and the Expect.pm module is relatively painless, and will result in a rock solid install for your production dependancies. Hopefully you can do this. Hope this helps, David Basham Slater Robert-WLRS12 <WL...@mo...> To: "'exp...@li...'" Sent by: <exp...@li...> exp...@li...urc cc: eforge.net Subject: [Expectperl-discuss] Where is send.al in Expect.pm module? 02/19/2003 08:55 AM Hello, I work in a CDMA test group for Motorola and we developed an automation tool written in Perl5. We have used the Expect.pm module to establish 'rlogin' session to various UNIX machines. Everything is working fine in our facility. We need to setup the same tool in a new lab in Bangalore, India. They purchased an Ultra5 UNIX machine to be there 'tools' server. We FTP'ed the Perl5 software distribution to this new machine including the Expect.pm module. We are now seeing the following error: Can't locate auto/Expect/send.al in @INC (@INC contains: . .. /usr/sbin /usr/test/atd/tools/Auto/Auto_Modules /usr/test/atd/tools/Auto/Auto_Modules/LapMessages /usr/perl5/5.00503/sun4-solaris /usr/Perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . /usr/test/atd/tools/Auto/R16_1/TEST_CASES) at /usr/test/atd/tools/Auto/Auto_Modules/RCval.pm line 318 Can you please tell me were the send.al method is located for the Expect.pm. We just need to know what the directory structure is relative to the Expect.pm module. Thanks for your help. Regards, Bob Slater ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: <db...@CT...> - 2003-02-19 15:29:40
|
Thanks. I see the perldoc covered this point, but unfortunately this was not clear to me at time of posting! Thanks for the really nice work on this module. I've been an avid user of the Tcl version of Expect over the years. Up until now, I've not found a replacement for the original version's ability to manage multiple interactive processes using indirect spawn Id list. This is very powerful feature I feel, and so this is really fantastic. Thanks, David Basham db...@ct... Roland Giersig To: db...@CT... <RGiersig@cpa cc: exp...@li... n.org> Subject: Re: [Expectperl-discuss] how to reference matchlist() when matching on multiple spawn id's 02/19/2003 07:07 AM Sorry for the belated reply... > Albeit a simple example, is there a proper way with multiple > processes to reference ($object->matchlist)[0], since I'm not > sure which \@sessions spawn_id matched? The callback gets the Expect object that matched as first paramter, i.e. expect($timeout, '-i', \@sessions, [ "([^\r\n]+)[\r\n]+", sub { my $obj = shift; my $match = ($obj->matchlist)[0]; # print the match.. exp_continue; } ], ); Hope this helps, Roland -- RGi...@cp... |
From: BLACKSTONE, J. D. <jda...@ci...> - 2003-02-19 15:13:33
|
> -----Original Message----- > From: Slater Robert-WLRS12 [mailto:WL...@mo...] > Sent: Wednesday, February 19, 2003 7:56 AM > To: 'exp...@li...' > Subject: [Expectperl-discuss] Where is send.al in Expect.pm module? > > > Hello, > > I work in a CDMA test group for Motorola and we developed an > automation tool written in Perl5. We have used the Expect.pm > module to establish 'rlogin' session to various UNIX > machines. Everything is working fine in our facility. > > We need to setup the same tool in a new lab in Bangalore, > India. They purchased an Ultra5 UNIX machine to be there > 'tools' server. We FTP'ed the Perl5 software distribution to > this new machine including the Expect.pm module. We are now > seeing the following error: > > Can't locate auto/Expect/send.al in @INC (@INC contains: . .. > /usr/sbin /usr/test/atd/tools/Auto/Auto_Modules > /usr/test/atd/tools/Auto/Auto_Modules/LapMessages > /usr/perl5/5.00503/sun4-solaris /usr/Perl5/5.00503 > /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . > /usr/test/atd/tools/Auto/R16_1/TEST_CASES) at > /usr/test/atd/tools/Auto/Auto_Modules/RCval.pm line 318 > > Can you please tell me were the send.al method is located for > the Expect.pm. We just need to know what the directory > structure is relative to the Expect.pm module. > > Thanks for your help. > > Regards, > > Bob Slater Bob, It sounds like you just tried to copy the whole perl distribution from one system to another. My experience says that never works out. :) I've never really understood where the .al files are. I think that's an autoloaded module file, with a split-out method (in this case, the send method) from the larger module. The autoloader looks it up somehow, in @INC. Your @INC contains some very unusual things, like /usr/sbin, which ordinarily does not contain Perl modules (or the autoloaded files and architecture specific shared libraries that often go with them). There's some kind of a configuration issue here that apparently applies to one machine but not the other. I highly recommend that your people become familiar with compiling perl from scratch on each machine, according to my instructions at http://use.perl.org/~jdavidb/journal/6477 . These kinds of configuration issues can be avoided when you build perl specifically for the machine. Alternatively, after following these instructions, you can turn the whole directory into a package for installation on machines of the same class. By "class," I don't just mean, "these are both Sun machines," but, "these are both Sun machines configured as a webserver for application Xyzzy with database option." This really becomes a configuration management issue. Trying to debug to confusions of modules and their locations and whether or not they are installed and possible lost pieces and how do we get Perl on machine2 when the app has only run on machine1 requires a formal policy based on experience. Just my 2cents; hope it helps. jdb |
From: Slater Robert-W. <WL...@mo...> - 2003-02-19 13:56:34
|
Hello, I work in a CDMA test group for Motorola and we developed an automation tool written in Perl5. We have used the Expect.pm module to establish 'rlogin' session to various UNIX machines. Everything is working fine in our facility. We need to setup the same tool in a new lab in Bangalore, India. They purchased an Ultra5 UNIX machine to be there 'tools' server. We FTP'ed the Perl5 software distribution to this new machine including the Expect.pm module. We are now seeing the following error: Can't locate auto/Expect/send.al in @INC (@INC contains: . .. /usr/sbin /usr/test/atd/tools/Auto/Auto_Modules /usr/test/atd/tools/Auto/Auto_Modules/LapMessages /usr/perl5/5.00503/sun4-solaris /usr/Perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 . /usr/test/atd/tools/Auto/R16_1/TEST_CASES) at /usr/test/atd/tools/Auto/Auto_Modules/RCval.pm line 318 Can you please tell me were the send.al method is located for the Expect.pm. We just need to know what the directory structure is relative to the Expect.pm module. Thanks for your help. Regards, Bob Slater |
From: Roland G. <RGi...@cp...> - 2003-02-19 12:07:58
|
Sorry for the belated reply... > Albeit a simple example, is there a proper way with multiple > processes to reference ($object->matchlist)[0], since I'm not > sure which \@sessions spawn_id matched? The callback gets the Expect object that matched as first paramter, i.e. expect($timeout, '-i', \@sessions, [ "([^\r\n]+)[\r\n]+", sub { my $obj = shift; my $match = ($obj->matchlist)[0]; # print the match.. exp_continue; } ], ); Hope this helps, Roland -- RGi...@cp... |
From: <db...@CT...> - 2003-02-13 23:11:56
|
Hello, Perhaps someone can help me. I'd like to determine which spawn_id matched, and print the match in an expect loop that is listening to multiple processes. For example, something like this, where \@sessions represents a collection of spawn_id's: expect($timeout, '-i', \@sessions, '-re', "([^\r\n]+)[\r\n]+", sub { # print the match.. exp_continue; } ); Albeit a simple example, is there a proper way with multiple processes to reference ($object->matchlist)[0], since I'm not sure which \@sessions spawn_id matched? In short, I'm not sure what $object should be in this case. I probably overlooked something in the Perldoc. Works great on single process; i.e., ($object->matchlist)[0] prints all the matches, assuming $object represents the spawn_id. thanks in advance, David Basham |
From: Roland G. <RGI...@cp...> - 2003-01-20 07:24:27
|
> Is it possible to use Perl::Expect scripts _under_ GNU Screen? > Now I have error message 'cannot open pty', when I run my script > from one of the Screen's windows. Script works fine on simple > telnet session without Screen. My operating system is FreeBSD 4.7. Hmm, as Screen is imposing a whole client-server architecture including job control between the user and the commandline, I can imagine that this can lead to problems, but I have no idea why Expect then shouldn't be able to allocate a pty. Sorry that I cannot be of any help. Roland -- RGi...@cp... |
From: Max T. <tim...@te...> - 2003-01-15 09:52:23
|
Hello! Is it possible to use Perl::Expect scripts _under_ GNU Screen? Now I have error message 'cannot open pty', when I run my script from one of the Screen's windows. Script works fine on simple telnet session without Screen. My operating system is FreeBSD 4.7. Thank you. -- Best regards, Max |
From: Jim C. <jc...@di...> - 2002-12-27 17:41:37
|
Jim Cromie wrote: > > > In case its not clear (and it appears that it was clear - or at least > that you understood me - I just want to be sure) > Im explicitly *not* trying to debug Expect or the external program it > spawns, > > one other thing - reviewing my (old) code - I found that I had added a cmd-line option to set $DB::single = 1 at a certain point in the Expect interaction. This jogged my memory - that I was once able to do this (ie the debugger stopped at that point), so it must have gotten past the hang-on-startup that prompted these questions. thx again, |
From: Jim C. <jc...@di...> - 2002-12-27 16:52:06
|
Roland Giersig wrote: > Sorry for replying so late... No problem - thanks for responding In case its not clear (and it appears that it was clear - or at least that you understood me - I just want to be sure) Im explicitly *not* trying to debug Expect or the external program it spawns, I want to avoid the debugger in the middle problem, and was hoping that I was insufficiently clever to have understood the debugger option that would suppress the sub-process' debugger. From what youve said, it would not be enough for the forked debugger to run in non-stop mode. So, Im thinking about trying to pre-spawn the external program, then attaching to it with my (modified) perl-prog under the debugger. Do you have any quick tips or advice wrt this approach ? tia jimc > > >> When trying to debug my cruft (elided), > >> I had a consistent problem hooking up to spawned process under the > >> debugger. > > Well, debugging programs that fork is not easy, and even binary > debuggers have their problems with such a case. It gets even worse for > the perl debugger: when the perl interpreter forks, it also means that > the debugger forks, in fact you are then dealing with two independent > debuggers that don't know of each other, but continue to share their > various filedescriptors, namely STDIN. So the parent process now sees > not the child it expects to, but the child-behind-a-debugger, which > may and often does result in confusion. > > I don't think there is really a solution for that problem, apart from > "if that hurts, don't do that". > > Oh, and that's why I'm trying to discourage the use of Expect (well, > actually IO::Tty) and point to other solutions, e.g. Net::Telnet > instead of spawning a telnet client. Expect still can be used with > Net::Telnet, but without the overhead of spawning another process. > There is even a > pure-perl implementation of ssh, but unfortunately without a > filedescriptor-interface that is usable with Expect... > > This leaves the good olde, but not very powerful debug-with-print... > > Sorry that I cannot be of more help. > > Roland > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility Learn to use your power > at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > . > |
From: Roland G. <RGI...@cp...> - 2002-12-14 19:40:02
|
Sorry for replying so late... >> When trying to debug my cruft (elided), >> I had a consistent problem hooking up to spawned process under the >> debugger. Well, debugging programs that fork is not easy, and even binary debuggers have their problems with such a case. It gets even worse for the perl debugger: when the perl interpreter forks, it also means that the debugger forks, in fact you are then dealing with two independent debuggers that don't know of each other, but continue to share their various filedescriptors, namely STDIN. So the parent process now sees not the child it expects to, but the child-behind-a-debugger, which may and often does result in confusion. I don't think there is really a solution for that problem, apart from "if that hurts, don't do that". Oh, and that's why I'm trying to discourage the use of Expect (well, actually IO::Tty) and point to other solutions, e.g. Net::Telnet instead of spawning a telnet client. Expect still can be used with Net::Telnet, but without the overhead of spawning another process. There is even a pure-perl implementation of ssh, but unfortunately without a filedescriptor-interface that is usable with Expect... This leaves the good olde, but not very powerful debug-with-print... Sorry that I cannot be of more help. Roland |
From: <Chr...@Ve...> - 2002-12-13 19:05:10
|
Just throw your perl-expect script into a shell script. Like the following: #!/bin/ksh FtpScript.pl Server1 & FtpScript.pl Server2 & FtpScript.pl Server3 & OPTIONAL for logging to a file FtpScript.pl Server4 >/some/dir/here/Server4.log & FtpScript.pl Server5 >/some/dir/here/Server5.log & etc.... This will launch each script in the background. You can also throw the out put into a log file if you want to see the data incase one of the scripts failed on a server. FtpScript #!/usr/local/bin/perl use Expect; my ($IP) = @ARGV; %ENV=(%ENV, TERM=>vt100, term=>vt100); ($telnet = Expect->spawn("ftp $IP")) || die "Could not spawn telnet"; #And the rest of your expect script to follow........ -----Original Message----- From: al....@ac... [mailto:al....@ac...] Sent: Friday, December 13, 2002 12:04 PM To: exp...@li... Subject: [Expectperl-discuss] Just a Question Hello, I recently started using Expect (1.15) with Perl (5.8.0) on Solaris ( 8 ) to automate some routine tasks. These tools have been of great help to me. Many thanks to the people who have developed and support these tools. I have written a script that ftps a file to about 20 servers (one server at a time) on demand. This process works fine but it could take long time (depending on the file size) for it to complete (please don't get hang on the ftp). I would like to rewrite my script so that it can execute the same command (like ftp) from my main server on all the other servers simultaneously ( I am not sure if this is called multi threading). Could someone please point me to some documents that can help me understand what is involved in writing such a script (like what is involved in estalishing connections to multiple servers simultaneously and control over input/output/error messages) . Since I am new to Expect, and not a strong Perl programmer, I was hoping maybe someone have already done something similiar to what I need to do. Any comments, sample program, or information is greatly appreciated. This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: <al....@ac...> - 2002-12-13 18:03:46
|
Hello, I recently started using Expect (1.15) with Perl (5.8.0) on Solaris ( 8 ) to automate some routine tasks. These tools have been of great help to me. Many thanks to the people who have developed and support these tools. I have written a script that ftps a file to about 20 servers (one server at a time) on demand. This process works fine but it could take long time (depending on the file size) for it to complete (please don't get hang on the ftp). I would like to rewrite my script so that it can execute the same command (like ftp) from my main server on all the other servers simultaneously ( I am not sure if this is called multi threading). Could someone please point me to some documents that can help me understand what is involved in writing such a script (like what is involved in estalishing connections to multiple servers simultaneously and control over input/output/error messages) . Since I am new to Expect, and not a strong Perl programmer, I was hoping maybe someone have already done something similiar to what I need to do. Any comments, sample program, or information is greatly appreciated. This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |
From: Paulo R. <pa...@se...> - 2002-12-12 10:21:18
|
My script work very well in shell( perl script.pl) When i try work in web, doesn't work. Why (i check permissions)? Paulo season.com.br |
From: Jim C. <jc...@di...> - 2002-12-11 20:58:34
|
Jim Cromie wrote: sorry to reply to myself, but this "bug" should be easily repeatable (or not) on your respective systems. Id like to know if this is a PEBCAK error (problem exists between chair and keyboard :-) thanks in advance. > > on linux RH-72 w current 2.4.18 > > When trying to debug my cruft (elided), > I had a consistent problem hooking up to spawned process under the > debugger. > > Ive 'reduced' it to a test-case that doesnt involve any of my stuff :-) > The hang under debugger is the same. > > forgive in advance if this is well known debugger option twizzle.. manually testing from my CPAN build directory, using the distributed test.pl, > > [root@harpo .cpan/build/Expect-1.15]# perl -d test.pl > > ... > on tests 16, 18not ok 16 > # Test failed at test.pl line 86. > some string > ok 17 > not ok 18 > # Test failed at test.pl line 95. > > Testing -notransfer... > > X some other > ok 19 > ... > ok 24 > > Testing raw reversing... > > isatty($exp): YES > > > I control C here, to break hang. > > > Expect::spawn(/usr/local/lib/perl5/site_perl/5.8.0/Expect.pm:125): > 125: die "Cannot sync with child: $!" if not defined $errstatus; > DB<1> c > Cannot sync with child: Interrupted system call at > /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 125. > Expect::spawn('Expect=GLOB(0x860c208)','/usr/local/bin/perl -ne > \'chomp; sleep 0; print scalar revers...') called at test.pl line 162 > Debugged program terminated. Use q to quit or R to restart, > use O inhibit_exit to avoid stopping after program termination, > h q, h R or h O to get additional info. DB<1> q > [root@harpo Expect-1.15]# > > > > a script capture is also attached unedited, but -pi -e's/\r//' cleaned. > > tia, jimc > > > [root@harpo Expect-1.15]# perl -V > Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: > Platform: > osname=linux, osvers=2.4.18-12.5, archname=i686-linux > uname='linux harpo.jimc.earth 2.4.18-12.5 #1 mon aug 26 08:51:52 > edt 2002 i686 unknown ' > config_args='-des -Accflags=-DDEBUGGING' > hint=previous, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef > usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm > -DDEBUGGING -DDEBUGGING', > optimize='-O2', > cppflags='-fno-strict-aliasing -I/usr/local/include > -I/usr/include/gdbm -fno-strict-aliasing -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm > -DDEBUGGING -fno-strict-aliasing -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm > -DDEBUGGING -DDEBUGGING' > ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2 > 2.96-108.7.2)', gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=4, prototype=define > Linker and Libraries: > ld='gcc', ldflags =' -L/usr/local/lib' > libpth=/usr/local/lib /lib /usr/lib > libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil > perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil > libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a > gnulibc_version='2.2.4' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' > cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' > > > Characteristics of this binary (from libperl): > Compile-time options: DEBUGGING USE_LARGE_FILES > Built under linux > Compiled at Sep 20 2002 03:36:26 > @INC: > /usr/local/lib/perl5/5.8.0/i686-linux > /usr/local/lib/perl5/5.8.0 > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux > /usr/local/lib/perl5/site_perl/5.8.0 > /usr/local/lib/perl5/site_perl > . > >------------------------------------------------------------------------ > >Script started on Wed Nov 20 16:17:36 2002 > > > > >[root@harpo Expect-1.15]# perl -d test.pl > >Loading DB routines from perl5db.pl version 1.19 >Editor support available. > >Enter h or `h h' for help, or `man perldebug' for more help. > >1..36 >main::(test.pl:3): $^W = 1; # warnings too >[4m DB<1> [24mc > >Basic tests... > >ok 1 >ok 2 >ok 3 >ok 4 > >Testing exec failure... > >ok 5 >Can't exec "Ignore_This_Error_Its_A_Test__efluna3w6868tn8": No such file or directory at /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 153. > Expect::spawn('Expect=GLOB(0x85a7a50)','Ignore_This_Error_Its_A_Test__efluna3w6868tn8') called at test.pl line 49 >Cannot exec(Ignore_This_Error_Its_A_Test__efluna3w6868tn8): > Expect::spawn('Expect=GLOB(0x85a7a50)','Ignore_This_Error_Its_A_Test__efluna3w6868tn8') called at test.pl line 49 >ok 6 >not ok 7 ># Test failed at test.pl line 50. >ok 8 > >Testing exp_continue... > >A >B >C >D >End >ok 9 >ok 10 >ok 11 >ok 12 >ok 13 >Begin >End >ok 14 >ok 15 >not ok 16 ># Test failed at test.pl line 86. >some string >ok 17 >not ok 18 ># Test failed at test.pl line 95. > >Testing -notransfer... > >X some other >ok 19 >ok 20 >ok 21 >ok 22 >ok 23 >EOF >ok 24 > >Testing raw reversing... > >isatty($exp): YES >Expect::spawn(/usr/local/lib/perl5/site_perl/5.8.0/Expect.pm:125): >125: die "Cannot sync with child: $!" if not defined $errstatus; >[4m DB<1> [24mc >Cannot sync with child: Interrupted system call at /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 125. > Expect::spawn('Expect=GLOB(0x860c208)','/usr/local/bin/perl -ne \'chomp; sleep 0; print scalar revers...') called at test.pl line 162 >Debugged program terminated. Use q to quit or R to restart, > use O inhibit_exit to avoid stopping after program termination, > h q, h R or h O to get additional info. >[4m DB<1> [24mq >]0;root@harpo:/usr/local/cpan/build/Expect-1.15[root@harpo Expect-1.15]# >Script done on Wed Nov 20 16:22:30 2002 > > |
From: Blackstone, J. D. <jda...@ci...> - 2002-12-06 22:13:28
|
I just answered my own question by watching the debugging information. Calls to expect with only one parameter will treat that parameter (a string) like the timeout (thank you, Perl; in five years that's the only time I ever regretted the ability to mix and match numbers and strings with impunity) and expect nothing. So I've just been getting REALLY, REALLY, LUCKY. :) jdb > -----Original Message----- > From: Blackstone, J. David > Sent: Friday, December 06, 2002 4:08 PM > To: 'exp...@li...' > Subject: Calling expect without a timeout parameter > > > Looking through some old source code (wow; when did it get > to the point that I had "old" code written with Expect.pm?), > I discovered some routines where I had written things like: > > $x->expect("String"); > $x->send("a\r"); > $x->expect("String2"); > > Apparently I got confused and was thinking of TCL/Expect's > expect command, which does not take the timeout as a parameter. > > Strangely, this code seems to work. Is the expect() method > designed to work like this, or am I just getting lucky by > cramming the right things into the buffer in the right order > and not running into race conditions? > > I'll probably digging through the source code to answer > this unless someone knows off the top of their head. If this > is a feature, not dumb luck, it could go into the docs > somewhere. (And if it's in the docs, I'll accept a cluestick > to my skull.) > > Thanks. > > jdb > |