a***a 发帖数: 62 | 1 w/out expect, how to write a robort?
such as login to a server, such as this bbs site? | h**h 发帖数: 132 | 2 use Net::Telnet
【在 a***a 的大作中提到】 : w/out expect, how to write a robort? : such as login to a server, such as this bbs site?
| a***a 发帖数: 62 | 3 can you give me a simple example?
following is mine:
*******************************************
#!/pkg/gnu/bin/perl
use Net::Telnet ();
use Net::Ping ();
use strict qw($mode);
$host = "hostname";
$t = new Net::Telnet (Timeout => 15);
$mode = sub { print "Now we step on to next host.\n";
next;
};
print "Now we try out host: $host\n";
$t->open($host);
$t->waitfor(Match => '/login[: ]*$/i',
Match => '/username[: ]*$/i');
$t->print("myusername");
$t->waitfor(Match
【在 h**h 的大作中提到】 : use Net::Telnet
| h**h 发帖数: 132 | 4 the problem is that you don't have Net::Telnet module installed
you can download it from cpan
Also it comes with a 20 pages manual, you can convert it into ps format
and have a nice print out format.
usually it is installed in site.... directory, instead
of standard lib | h**h 发帖数: 132 | 5 btw, did you try expect lib in C?
there is a chapter in Exporing Expect, introducing
how to embedded expect funtion into C
【在 h**h 的大作中提到】 : the problem is that you don't have Net::Telnet module installed : you can download it from cpan : Also it comes with a 20 pages manual, you can convert it into ps format : and have a nice print out format. : usually it is installed in site.... directory, instead : of standard lib
| a***a 发帖数: 62 | 6 no, i can't install expect ah,
to install it, i should have root permit. I am in unix,
not linux.
【在 h**h 的大作中提到】 : btw, did you try expect lib in C? : there is a chapter in Exporing Expect, introducing : how to embedded expect funtion into C
| a***a 发帖数: 62 | 7 ok, Now i install that in my private directory, such as
~/lib/perl/Net/Telnet.pm
and change the PATH env include that
but it still say can't locate it, it only search in
/pkg/perl..... not my directory, do u know what's wrong?
【在 h**h 的大作中提到】 : the problem is that you don't have Net::Telnet module installed : you can download it from cpan : Also it comes with a 20 pages manual, you can convert it into ps format : and have a nice print out format. : usually it is installed in site.... directory, instead : of standard lib
| a***a 发帖数: 62 | 8 i got it in this way,
go to ~/lib/perl/ to run my program, stupid way.
【在 a***a 的大作中提到】 : ok, Now i install that in my private directory, such as : ~/lib/perl/Net/Telnet.pm : and change the PATH env include that : but it still say can't locate it, it only search in : /pkg/perl..... not my directory, do u know what's wrong?
|
|