From: Dan Y. <dan...@sa...> - 2004-02-27 20:47:12
|
I'm trying to user Perl/Expect to spawn sqlplus and connect to a database via the Net8 vs. IPC. I'm running into problems with the @ character in the connect string, i.e connect scott/tiger@mydb, with $exp->send. I've tried to escape it with \@ but it doesn't work. Does anyone have any ideas or do I nned to stick to IPC connections???? Thank you, Dan |
From: Roland G. <RGi...@cp...> - 2006-08-16 09:58:09
|
how about doing a $exp->send("version\r"); ?? PS: BTW, what is Nabble.com?! On 8/15/06, fastaero <raj...@gm...> wrote: > > my $exp = Expect->spawn("telnet 1.2.3.4"); > > my $timeout = 10; > my $username = 'lab'; > my $password = 'test1'; > > my $spawn_ok; > $exp->expect($timeout, > [ > qr'login:', > sub { > $spawn_ok = 1; > my $fh = shift; > $fh->send("$username\n"); > exp_continue; > } > ], > [ > qr'Password:', > sub { > my $fh = shift; > $fh->send("$password\n"); > exp_continue; > } > ], > eof => > sub { > if ($spawn_ok) { > die "ERROR: premature EOF in login.\n"; > } else { > die "ERROR: could not spawn telnet.\n"; > } > } > ], > [ > timeout => > sub { > die "No login.\n"; > } > ], > '-re',qr'>', #' wait for shell prompt, then exit expect > > ); > > my $exp1 = Expect->spawn("load"); > print "$exp1\n"; > > > how do I execute commands on the telneted machine using the above scripts? > login and password works fine, I want to execute "version" and get the > version number of the machine. How can I do that with using about sub? > > > my $telnet = new Net::Telnet ("1.2.3.4") > or die "Cannot telnet to remotehost: $!\n"; > #my $exp = Expect->exp_init($telnet); > > This is not working for some reason? Any ideas on why? > > Thanks > -- > View this message in context: http://www.nabble.com/need-help-with-expect%28%29-tf2107189.html#a5808510 > Sent from the Perl - Expectperl-Discuss forum at Nabble.com. > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > -- RGi...@cp... |
From: sarab9 <sa...@ya...> - 2006-09-13 23:30:48
|
Hi All, I am trying to use the Expect.pm bundle in windows environment, but getting stuck. Could really use your suggestions/comments. I have a "use Expect.pm" that calls "use IO::Pty" which calls "IO::Tty", and IO::Tty fails to find loadable object. I dont know which one it is looking for. The same codebase works fine in Linux environment and all loadable files exist in the same locations in the codebase. What do i need to change to get Expect.pm to work on Windows? The error looks like this: Can't locate loadable object for module IO::Tty in @INC (@INC contains: E:\star/ lib/common E:\star/lib/user E:\star/harness/web E:/Perl/site/lib E:/Perl/lib .) at E:\star/lib/common/IO/Tty.pm line 28 Compilation failed in require at E:\star/lib/common/IO/Pty.pm line 7. BEGIN failed--compilation aborted at E:\star/lib/common/IO/Pty.pm line 7. Compilation failed in require at E:\star/lib/common/Expect.pm line 22. BEGIN failed--compilation aborted at E:\star/lib/common/Expect.pm line 22. Line 28 of IO/Tty.pm contains: do { defined(&bootstrap) ? \&bootstrap : \&DynaLoader::bootstrap }->(__PACKAGE__); } I even tried it from a cygwin terminal and got the same errors, even though it says that IO:Tty is supported from cygwin terminals. Thanks in advance for your comments/suggestions. Sarabjeet --------------------------------- Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail. |
From: Austin S. <te...@of...> - 2006-09-14 00:04:39
|
On Wed, Sep 13, 2006 at 04:30:41PM -0700, sarab9 wrote: > at E:\star/lib/common/IO/Tty.pm line 28 > Compilation failed in require at E:\star/lib/common/IO/Pty.pm line 7. > BEGIN failed--compilation aborted at E:\star/lib/common/IO/Pty.pm line 7. > Compilation failed in require at E:\star/lib/common/Expect.pm line 22. > BEGIN failed--compilation aborted at E:\star/lib/common/Expect.pm line 22. > > Line 28 of IO/Tty.pm contains: > > do { > defined(&bootstrap) > ? \&bootstrap > : \&DynaLoader::bootstrap > }->(__PACKAGE__); > } > > I even tried it from a cygwin terminal and got the same errors, even though it says that IO:Tty is supported from cygwin terminals. > I'm able to successfully install Expect from the cygwin environment. However, the paths from perl -V in the cygwin shell are normal unix-like /usr/lib type paths. You are doing something weird, not sure what. If you do perl -MCPAN -eshell from the cygwin shell and run 'install Expect' there it should work if your cygwin environment is properly set up. Austin |
From: Roland G. <rgi...@cp...> - 2006-09-14 10:02:11
|
You need to install IO::Tty beforehand, it's a separate module. And you can only install and use it under cygwin and with the perl provided by cygwin. Be sure to read the FAQ, you don't need Expect to automate ssh logins... Hope this helps, Roland On 9/14/06, sarab9 <sa...@ya...> wrote: > Hi All, > > I am trying to use the Expect.pm bundle in windows environment, but getting > stuck. Could really use your suggestions/comments. > > I have a "use Expect.pm" that calls "use IO::Pty" which calls "IO::Tty", and > IO::Tty fails to find loadable object. I dont know which one it is looking > for. The same codebase works fine in Linux environment and all loadable > files exist in the same locations in the codebase. > > What do i need to change to get Expect.pm to work on Windows? > > The error looks like this: > > Can't locate loadable object for module IO::Tty in @INC (@INC contains: > E:\star/ > lib/common E:\star/lib/user E:\star/harness/web E:/Perl/site/lib E:/Perl/lib > .) > at E:\star/lib/common/IO/Tty.pm line 28 > Compilation failed in require at E:\star/lib/common/IO/Pty.pm line 7. > BEGIN failed--compilation aborted at E:\star/lib/common/IO/Pty.pm line 7. > Compilation failed in require at E:\star/lib/common/Expect.pm line 22. > BEGIN failed--compilation aborted at E:\star/lib/common/Expect.pm line 22. > > Line 28 of IO/Tty.pm contains: > > do { > defined(&bootstrap) > ? \&bootstrap > : \&DynaLoader::bootstrap > }->(__PACKAGE__); > } > > I even tried it from a cygwin terminal and got the same errors, even though > it says that IO:Tty is supported from cygwin terminals. > > Thanks in advance for your comments/suggestions. > > Sarabjeet > > > ________________________________ > Do you Yahoo!? > Get on board. You're invited to try the new Yahoo! Mail. > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > |
From: Ron S. <gee...@ya...> - 2010-05-26 04:15:25
|
http://yatojunu.angelfire.com/ |
From: Madhav k. <mad...@ho...> - 2010-10-10 01:03:51
|
http://qurl.com/9rz7b |
From: Madhav k. <mad...@ho...> - 2010-11-16 00:31:09
|
http://goo.gl/YEW11 |
From: vijaya l. <vla...@ya...> - 2011-05-01 17:03:36
|
vla...@ya... |
From: vijaya l. <vla...@ya...> - 2011-05-01 17:15:13
|
Hi, I am new to Perl and Expect. I am trying to spawn telnet to remote machine and trying to execute some command one by one after receiving the details of commands. Please explain me How $exp->send is working. When we send command to remote machine via $exp ->send, Is the output of command returns to this? If so, how much time it is taking to do this process.? Will there be any delay in $exp->send ? Please explain me.. |
From: Austin S. <te...@of...> - 2004-02-27 23:55:14
|
On Fri, Feb 27, 2004 at 01:25:27PM -0700, Dan Young wrote: > I'm trying to user Perl/Expect to spawn sqlplus and connect to a database via the Net8 vs. IPC. I'm running into problems with the @ character in the connect string, i.e connect scott/tiger@mydb, with $exp->send. I've tried to escape it with \@ but it doesn't work. Does anyone have any ideas or do I nned to stick to IPC connections???? IIRC you can put the the connect string on the command line, like 'sqlplus scott/tiger@mydb'. I'm not sure why send is giving you grief, but you can simply print to it: print $exp 'connect scott/tiger@mydb' . "\r"; If that doesn't work you're probably doing something wrong and should try using the documented debugging methods. Austin |