in reply to Re^2: Is it possible to force MIME::Parser to extract text-files on a Windows system without the extra CR's on the end of lines?
in thread Is it possible to force MIME::Parser to extract text-files on a Windows system without the extra CR's on the end of lines?

Thank you Athanasius, I have gone down the path of changing the content-type to something that will extract text/plain as binary files (application/x-msexcel). The code I'm using now is:

# open the file in raw/binary output for writing open MAILOUT, '>:raw', "$receiving/message-$thetime-$popcount.msg" + or LogWrite("Unable to open message-$thetime-$popcount.msg for writi +ng: $!"); # get the email into a temporary variable my $hold = $pop->HeadAndBody($popcount); # force it to use binary saving $hold =~ s/text\/plain/application\/x-msexcel/g; # write to file print MAILOUT $hold; # close the file close MAILOUT;

And the text-files extracted by MIME::Parser are now saved without extra \r characters added to them.

Cheers for the help! :)
William

  • Comment on Re^3: Is it possible to force MIME::Parser to extract text-files on a Windows system without the extra CR's on the end of lines?
  • Download Code

Replies are listed 'Best First'.
Re^4: Is it possible to force MIME::Parser to extract text-files on a Windows system without the extra CR's on the end of lines?
by Anonymous Monk on Feb 12, 2014 at 04:12 UTC
    $cough->binary(1); ... print ...

      Not sure what you mean, my anonymous friend. Would you please explain further?

      Cheers,
      William

      PS: Have altered the documentation in my code to be properly clear, now using:

      # change it to use binary extraction when MIME::Parse extracts tex +t files from the mail message $hold =~ s/text\/plain/application\/x-msexcel/g;

        Not sure what you mean, my anonymous friend. Would you please explain further?

        Can you guess? ... some Body object or something has a mutator called binary that controls whether or not to use newline translation ...