Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 2189
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: DJKERNEN__NO_SOLICITING__ [...] cpan.org
Requestors: rlb [...] modeln.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



From: Bob Brown <rlb [...] modeln.com>
To: "'bug-Mail-IMAPClient [...] rt.cpan.org'" <bug-Mail-IMAPClient [...] rt.cpan.org>
Subject: IMAPClient get_envelope fails, uses grep() incorrectly
Date: Thu, 6 Mar 2003 21:57:41 -0800
If you don't know of this problem and need a slimmed down script to show it, get back to me. This is sufficiently obvious I'd be surprised to find out that it's not a dup. Perl 5.8.0 on RH 8.0, talking to an Exchange Server of unknown version (but I tried the UW imapd and it failed, too). The IMAPClient.pm RCS Id contains 20001010.18 2002/12/13 18:08:39 and I downloaded it from CPAN today. Grep returns an array of lines, not a scalar, at least according to the manual. get_envelope was failing for me every time because it was expecting a scalar return from grep. I made the changes below to IMAPClient.pm and get_envelope started working immediately. Bob Brown ----------------------------------- Robert L. Brown +1-650-808-8138 Vice President, Product Development Model N, Inc. http://www.modeln.com *** IMAPClient.pm~ 2003-01-23 13:25:11.000000000 -0800 --- IMAPClient.pm 2003-03-06 21:56:39.000000000 -0800*************** *** 2216,2226 **** } my $bs = ""; my @out = $self->fetch($msg,"ENVELOPE"); ! my $output = grep( /ENVELOPE \(/i, @out # Wee! ;-) ); ! if ( $output =~ /\r\n$/ ) { ! eval { $bs = Mail::IMAPClient::BodyStructure::Envelope->new( $output )}; } else { $self->_debug("get_envelope: reassembling original response\n"); my $start = 0; --- 2216,2226 ---- } my $bs = ""; my @out = $self->fetch($msg,"ENVELOPE"); ! my @output = grep( /ENVELOPE \(/i, @out # Wee! ;-) ); ! if ( scalar(@output) > 0 ) { ! eval { $bs = Mail::IMAPClient::BodyStructure::Envelope->new( $output[0] )}; } else { $self->_debug("get_envelope: reassembling original response\n"); my $start = 0;
From: Bob Brown <rlb [...] modeln.com>
To: "'bug-Mail-IMAPClient [...] rt.cpan.org'" <bug-Mail-IMAPClient [...] rt.cpan.org>
Subject: RE: [cpan #2189] AutoReply: IMAPClient get_envelope fails, uses g rep() incorrectly
Date: Fri, 7 Mar 2003 00:05:39 -0800
RT-Send-Cc:
The problem is more complicated, it seems. What I sent in earlier applies, but because the full IMAP string that needs to be passed to ::Envelope->new() may have beeen broken into several pieces, it must be concatenated together again. This situation arises when the IMAP server sends back a response to the "FETCH ENVELOPE" command with a LITERAL in it. That causes the output (created by _readline) be be split into several entries in the output array, if I'm reading it right, comes through fetch() if it's called in an array context, which it is in get_envelope. So I removed grep and loop through the lines looking for "( ENVELOPE" and then begin concatenating lines and pass that result to ::Envelope->new. But, my Exchange server sent back a LITERAL style string because the Subject line of a mail message had a quotation mark in it. That quotation mark causes ::Envelope->new to fail as well. So, back in _readline, I escaped the quotation marks and then wrapped the whole of $litstring in another layer of quotation marks when pushed onto the output array. I am *sure* this is not the right thing to do. This code needs a bit of work. It's fairly impressive as-is, but needs some more work. Show quoted text
-----Original Message----- From: Mail-IMAPClient [mailto:bug-Mail-IMAPClient@rt.cpan.org] Sent: Thursday, March 06, 2003 9:58 PM To: rlb@modeln.com Subject: [cpan #2189] AutoReply: IMAPClient get_envelope fails, uses grep() incorrectly Greetings, This message has been automatically generated in response to your bug report about Mail-IMAPClient, a summary of which appears below. There is no need to reply to this message right now. Your bug in Mail-IMAPClient has been assigned an ID of [cpan #2189]. Please include the string: [cpan #2189] in the subject line of all future correspondence about this issue. To do so, you may reply to this message. Thank you, bug-Mail-IMAPClient@rt.cpan.org ------------------------------------------------------------------------- If you don't know of this problem and need a slimmed down script to show it, get back to me. This is sufficiently obvious I'd be surprised to find out that it's not a dup. Perl 5.8.0 on RH 8.0, talking to an Exchange Server of unknown version (but I tried the UW imapd and it failed, too). The IMAPClient.pm RCS Id contains 20001010.18 2002/12/13 18:08:39 and I downloaded it from CPAN today. Grep returns an array of lines, not a scalar, at least according to the manual. get_envelope was failing for me every time because it was expecting a scalar return from grep. I made the changes below to IMAPClient.pm and get_envelope started working immediately. Bob Brown ----------------------------------- Robert L. Brown +1-650-808-8138 Vice President, Product Development Model N, Inc. http://www.modeln.com *** IMAPClient.pm~ 2003-01-23 13:25:11.000000000 -0800 --- IMAPClient.pm 2003-03-06 21:56:39.000000000 -0800*************** *** 2216,2226 **** } my $bs = ""; my @out = $self->fetch($msg,"ENVELOPE"); ! my $output = grep( /ENVELOPE \(/i, @out # Wee! ;-) ); ! if ( $output =~ /\r\n$/ ) { ! eval { $bs = Mail::IMAPClient::BodyStructure::Envelope->new( $output )}; } else { $self->_debug("get_envelope: reassembling original response\n"); my $start = 0; --- 2216,2226 ---- } my $bs = ""; my @out = $self->fetch($msg,"ENVELOPE"); ! my @output = grep( /ENVELOPE \(/i, @out # Wee! ;-) ); ! if ( scalar(@output) > 0 ) { ! eval { $bs = Mail::IMAPClient::BodyStructure::Envelope->new( $output[0] )}; } else { $self->_debug("get_envelope: reassembling original response\n"); my $start = 0;
This bug will be fixed in the next release. I do not have a patch yet because I'd rather focus on getting the next release ready but if anyone has an urgent need they can e-mail at DJKERNEN@cpan.org and I'll send a patch out to them. -- Dave K.