Looking at the source code of SOAP::Packager::MIME, the meat of it seems to be the sub ->package, which adds some headers to the MIME entity and after that calls $top->stringify_body;. So maybe the main trick is to use your own MIME::Entity subclass which has a better ->stringify_body:
package MIME::Entity::Ray;
use strict;
use parent 'MIME::Entity';
sub stringify_body {
my( $self ) = @_;
my $body = $self->SUPER::stringify_body();
$body =~ s!\n!\r\n!g;
return $body
};
And then instead of creating your own MIME::Entity objects create MIME::Entity::Ray objects instead.
If that still fails, maybe something else is creating MIME::Entity objects. Then either edit the source code or monkey patch MIME::Entity:
use MIME::Entity;
my $old_stringify_body = \&MIME::Entity::stringify_body;
*MIME::Entity::stringify_body = sub {
my( $self ) = @_;
my $body = $self->SUPER::stringify_body();
$body =~ s!\n!\r\n!g;
return $body
};
Update: After looking some more at SOAP::Packager, it even tries to do the Right Thing by setting:
local $MIME::Entity::BOUNDARY_DELIMITER = "\r\n";
except that MIME::Entity does not use that variable.
The real solution would be to make MIME::Entity use that variable. |