Skip Menu |

This queue is for tickets about the Net-IMAP-Simple CPAN distribution.

Report information
The Basics
Id: 122706
Status: open
Priority: 0/
Queue: Net-IMAP-Simple

People
Owner: Nobody in particular
Requestors: tlhackque [...] yahoo.com
Cc:
AdminCc:

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



Subject: get() sends the wrong IMAP specifier
In 1.2209, the "get" method is documented as accepting body part specifiers, which should be sent to IMAP as "BODY[$partSpecifiers]". However, while the method sets up the specification correctly, it is not passed to fetch - instead, the specifier is passed to fetch. The net effect is that get aliases fetch. See below: sub get { my ( $self, $number, $part ) = @_; my $arg = $part ? "BODY[$part]" : 'RFC822'; # $part should be $arg in the following line return $self->fetch( $number, $part ); } As a work-around, one can call fetch with "BODY[$part]". Further, fetch is documented as accepting a message range and returning a hash. In fact, it returns an array - and seems to only access the first message of a range. If I specify $mbx->fetch("1:2", 'BODY[HEADER]'), I get the headers for message 1, with 2 extra lines shown as 21,22 below: 19 "Date: Fri, 28 Apr 2017 11:50:22 -0400 (EDT)\cM\cJ" 20 "\cM\cJ" 21 ")\cM\cJ" 22 'X' Message 2 is not marked seen. If I fetch just "1", the return value ends normally. 19 "Date: Fri, 28 Apr 2017 11:50:22 -0400 (EDT)\cM\cJ" 20 "\cM\cJ" This appears to be a documentation error. (Server is dovecot.)
I forgot why that was even done like that. There was a reason. There's probably a test that will fail if we change it that may explain it. I think I introduced bugs a few revisions ago, but I couldn't figure it out and then lost interest due to work. The tests were passing so I forgot about it. If it's wrong though, we should probably change it and address the test failures with separate methods for those purposes (whatever they are). Submit PRs here if you get tired of waiting on me. https://github.com/jettero/net--imap--simple On Fri Aug 04 07:09:22 2017, tlhackque wrote: Show quoted text
> In 1.2209, the "get" method is documented as accepting body part > specifiers, which should be sent to IMAP as "BODY[$partSpecifiers]". > > However, while the method sets up the specification correctly, it is > not passed to fetch - instead, the specifier is passed to fetch. The > net effect is that get aliases fetch. > > See below: > > sub get { > my ( $self, $number, $part ) = @_; > my $arg = $part ? "BODY[$part]" : 'RFC822'; > > # $part should be $arg in the following line > > return $self->fetch( $number, $part ); > } > > As a work-around, one can call fetch with "BODY[$part]". > > Further, fetch is documented as accepting a message range and > returning a hash. In fact, it returns an array - and seems to only > access the first message of a range. If I specify $mbx->fetch("1:2", > 'BODY[HEADER]'), I get the headers for message 1, with 2 extra lines > shown as 21,22 below: > > 19 "Date: Fri, 28 Apr 2017 11:50:22 -0400 (EDT)\cM\cJ" > 20 "\cM\cJ" > 21 ")\cM\cJ" > 22 'X' > > Message 2 is not marked seen. > > If I fetch just "1", the return value ends normally. > > 19 "Date: Fri, 28 Apr 2017 11:50:22 -0400 (EDT)\cM\cJ" > 20 "\cM\cJ" > > This appears to be a documentation error. > > (Server is dovecot.) >
-- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.