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;