[Petal] Petal::Mail Encode

Colin Fallon colinf at mac.com
Sat Feb 28 20:57:12 GMT 2004


>Well there is a CPAN module called Encode::Compat. You could try doing:
>
>use Encode::Compat;
>use Petal::Mail;
>
>and see what happens :)
>
>Cheers,
>Jean-Michel.

William & Jean-Michel,

Thanks for your replies. I had a look at Encode::Compat on cpan but
didn't go any further both because there was a warning in block caps
about it being a proof of concept and because it needs Perl 5.6.1 and
the ISP for the site in question is still on 5.6.

However, I tried removing use Encode altogether and also removing the
single line in Mail.PM which uses it:

$text = encode ('MIME-Header', $text);

This seems to work for the fairly simple e-mails which I am creating. If
you think removing this line will cause some dire problem of which I am
not aware, please warn me!!

I have also noticed that contrary to the documentation if you use the
Petal::Mail->send function you need to use a hash (i.e. a hashref
doesn't work). A suggested fix would be to replace the 2nd line of the
send function which currently reads:

my %args = @_;

with something like:

my %args = undef;
if (ref($_[0]) eq 'HASH') {
    %args = %{shift()};
}
else {
    %args = @_;
}

Cheers,
  Colin


More information about the Petal mailing list