3 BEGIN { $SIG{'__WARN__'} = sub {};};
5 $hostname = "criens.u-psud.fr";
6 $username = "p99dreyf";
8 $command = "exec ~/bin/imapd";
11 $host = new Net::Telnet (Timeout => 10,
13 Prompt => '/p99dreyf>\s?$/',
14 Cmd_remove_mode => 1);
16 $host->option_accept(Dont => &Net::Telnet::TELOPT_ECHO,
17 Wont => &Net::Telnet::TELOPT_ECHO);
19 $host->dump_log("log2");
20 $host->input_log("log3");
21 ## Issue some commands.
22 $host->open($hostname);
23 #$host->login($username, $passwd);
24 $host->waitfor('/login:\s?$/');
25 $host->print("$username");
26 $host->waitfor('/Password:\s?$/');
27 $host->print("$passwd");
28 $host->waitfor('/p99dreyf>\s?$/');
30 $host->print("$command");
33 $greeting=$host->getline();
34 if ($greeting=~/^\* PREAUTH.*$/) { print "$greeting"; $strip=0;};
40 } while ($cmd !~/[A-Za-z0-9]/);
42 print FILE ">>$cmd<<\n";
44 $line=$host->getline();
47 print FILE "<<$line<<\n";
48 } while (($line!~/^[A-Za-z0-9]+ (OK|BAD|Expunge).*$/) &&
49 ($line!~/^\* BAD.*$/));
50 print FILE "--next cmd\n";
51 } while ($line!~/^[A-Za-z0-9]+ OK LOGOUT.*$/);