Redian新闻
>
how to write robort in perl w/out expect?
avatar
how to write robort in perl w/out expect?# Unix - 噫吁兮,危乎高哉
a*a
1
w/out expect, how to write a robort?
such as login to a server, such as this bbs site?
avatar
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?

avatar
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
avatar
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
avatar
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

avatar
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

avatar
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

avatar
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?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。