Skip Menu |

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

Report information
The Basics
Id: 128299
Status: rejected
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: Nobody in particular
Requestors: jidanni [...] jidanni.org
Cc:
AdminCc:

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



Subject: Document how to save messages without carriage returns added
Apparently the user has no way to use Strip_cr before he uses message_to_file. So perhaps document some workarounds: (untested) ## $imap->message_to_file( $tempfile, $_ ) ## or die "Could not send message_to_file: $@\n"; my $string = $imap->message_string($_) or die "Could not produce message_string: $@\n"; my $stripped = $imap->Strip_cr($string); open(my $fh, ">", $tempfile) or die "Can't open > $tempfile: $!"; print $fh $string or die; close $fh or die; Also document what Strip_cr will do upon failure and how to print an error message for it. Thanks.
Oops, print $fh $stripped or die;
On Sat Jan 19 22:22:32 2019, jidanni@jidanni.org wrote: Show quoted text
> Oops, > print $fh $stripped or die;
I haven't tried it myself, but have you thought about using something like PerlIO::eol to utilize a layer that will do what you like? This would seem like a good place for an IO layer. Otherwise you could create your own message_to_file type of function as you noted. This doesn't, in my opinion, feel like something that requires documentation within Mail::IMAPClient though as CRLF line endings are what most would expect to see when dealing with IMAP. Also, please note Strip_cr doesn't have an error mode. It utilizes s/$CRLF/\n on the arg(s) provided. Closing this one as I'm not seeing anything specific that should be changed.