Date: | Tue, 03 Jan 2006 16:51:30 +1100 |
From: | Nathan Bailey <Nathan.Bailey [...] its.monash.edu> |
Subject: | Zero-length body part causes bodypart_string() to fail? |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
I can provide more debugging info if required, but I suspect I may have
identified the cause already. There is a short (zero)? text/plain part
to the message below (mixed output from my script and $imap->Debug(1)).
IMAP seems to think the fetch was successful ('OK'), but
bodypart_string fails, with no error message (blank $@ after the colon).
My version of Mail::IMAPClient says:
# $Id: IMAPClient.pm,v 20001010.20 2003/06/13 18:30:55 dkernen Exp $
$Mail::IMAPClient::VERSION = '2.2.9';
This code (lines 592..595 of Mail::IMAPClient) seems to assume that
there will be a data in the return (which in this case, there isn't)
foreach my $result (@{$self->{"History"}{$self->Transaction}}) {
$string .= $result->[DATA]
if defined($result) and $self->_is_literal($result) ;
}
but since $string is initialised to an empty string (line 590), I can't
see why this is actually failing...
thanks,
Nathan
PS: Is there any documentation for Mail::IMAPClient::BodyStructure? I
am using it by parsing the object, which seems a little brutal, because
I'm not sure what methods I'm supposed to be using :-)
=======
$imap->Debug(1) transcript:
Sending: 6 CAPABILITY
Sent 14 bytes
Read: * CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ NAMESPACE UIDPLUS CHILDREN
LANGUAGE STARTTLS XSENDER X-NETSCAPE XSERVERINFO
6 OK Completed
Sending: 7 FETCH 186 BODY[1]
Sent 21 bytes
Read: * 186 FETCH (BODY[1] "")
7 OK Completed
Could not get bodypart string (1) for 186:
Trying body_string(186) instead
Sending: 8 FETCH 186 BODY[TEXT]
Sent 24 bytes
LITERAL: received literal in line * 186 FETCH (BODY[TEXT] of length 81451; atte
mpting to retrieve from the 1415 bytes in: This is a multi-part message in MIME
format.
--Boundary_(ID_6PD3KJOxYTJ3B8LtHikoGA)
Content-type: text/plain; charset=windows-1252; format=flowed
Content-transfer-encoding: 7BIT
--Boundary_(ID_6PD3KJOxYTJ3B8LtHikoGA)
Content-type: message/rfc822; name="Approach for Monash"
...