A small difficulty with Net::IMAP
I installed libnet-imap-perl on Sarge so I could chat up an imap server,
did a quick cut and paste from the two samples provided and it does not
Work For Me.
Here-s my code:
#!/usr/bin/perl -wI..
use Net::IMAP;
my $Host="192.168.9.4";
my $imap = new Net::IMAP($Host, Debug => 1)
or die("can't connect to $Host: $!\n");
$response = $imap->noop
or die("noop failed");
print "noop returned: ", $response->status, "\n";
print "noop text: ", $response->text, "\n";
if ($imap->has_capability('namespace')) {
$response = $imap->namespace
or die("namespace command failed");
} else {
warn("server doesn't implement namespace extension");
}
$response = $imap->logout
or die "error sending logout: $!";
Here's what happens when I run it under strace:
summer@Dolphin:~$ strace -f -F -e trace=network imap.getmail
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(143),
sin_addr=inet_addr("192.168.9.4")}, 16) = -1 EINPROGRESS (Operation now
in progress)
connect(3, {sa_family=AF_INET, sin_port=htons(143),
sin_addr=inet_addr("192.168.9.4")}, 16) = 0
<- Net::IMAP=HASH(0x81717a4) 19:29:05 [* OK ns Cyrus IMAP4
v2.1.16-IPv6-Debian-2.1.16-6 server ready]
can't connect to 192.168.9.4: Bad file descriptor
summer@Dolphin:~$
I'm inclined to reportbug this, but I'd like to have it working. Any hints?
--
Cheers
John
-- spambait
1aaaaaaa@computerdatasafe.com.au Z1aaaaaaa@computerdatasafe.com.au
Reply to: