w/out expect, how to write a robort? such as login to a server, such as this bbs site?
h*h
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
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
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
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
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
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
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?