Re: A small difficulty with Net::IMAP, encore
John Summerfield wrote:
John Summerfield wrote:
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");
More info:
215 $self->{ResponseCallback} = $self->imap_response_callback;
216
217 STDERR->autoflush(1);
218
219 # $self->_get_banner or return undef;
220 print "Banner\n";
221
222 # the little back-flip here with the Synchronous option
ensures that
Line 219 in this list was the culprit. The line nos aren't quite as
in the original, I have a couple of lines of debugging code.
I'm inclined to reportbug this, but I'd like to have it working. Any
hints?
I seem to be talking to myself here:-(
I've reported a second bug. Here's the latest code:
#!/usr/bin/perl -wI..
use Net::IMAP;
my $Host="192.168.9.4";
my $imap = new Net::IMAP($Host, Debug => 0)
or die("can't connect to $Host: $!\n");
$response = $imap->noop
or die("noop failed");
print "noop returned: ", $response->status, "\n";
print "Logging in $ARGV[0], $ARGV[1]\n";
$response = $imap->login($ARGV[0], $ARGV[1])
or die "error logging in: $!";
print "login 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:
summer@Dolphin:~$ imap.getmail zz yy
noop returned: ok
Logging in xx, yy
login text: User logged in
Can't use string ("NIL") as an ARRAY ref while "strict refs" in use at
/usr/share/perl5/Net/IMAP.pm line 2398, <GEN0> line 6.
summer@Dolphin:~$
The "banner" line above is commented out.
The code in Net/IMAP.pm leaves me scratching my head. Anyone more
familiar than I with Perl care to take a look?
--
Cheers
John
-- spambait
1aaaaaaa@computerdatasafe.com.au Z1aaaaaaa@computerdatasafe.com.au
Reply to: