Subject: | MaxLineLen is global |
The paramater, "MaxLineLen" is global, and can only be set once, in MIME::EcodeWords:
#!/usr/bin/perl
use MIME::EncWords;
use strict;
my $value = '<http://example.com/a/very/long/url/that/points/to/something/important/without/any/utf-8/>';
my $MaxLineLen = 76;
print "encoded:\n";
print MIME::EncWords::encode_mimewords(
$value,
Encoding => 'Q',
Charset => 'UTF-8',
MaxLineLen => $MaxLineLen,
) ;
print "\n";
print "no encoded needed:\n";
$MaxLineLen = 1176;
print MIME::EncWords::encode_mimewords(
$value,
Encoding => 'Q',
Charset => 'UTF-8',
MaxLineLen => $MaxLineLen,
) ;
prints,
encoded:
=?UTF-8?Q?=3Chttp=3A//example=2Ecom/a/very/long/url/that/points/to/somethi?=
=?UTF-8?Q?ng/important/without/any/utf-8/=3E?=
no encoded needed:
=?UTF-8?Q?=3Chttp=3A//example=2Ecom/a/very/long/url/that/points/to/something/important/without/any/utf-8/=3E?=
The value set in the "MaxLineLen" in the first call to "encode_mimewords" affects the second call.
If you try just:
#!/usr/bin/perl
use MIME::EncWords;
use strict;
my $value = '<http://example.com/a/very/long/url/that/points/to/something/important/without/any/utf-8/>';
print "no encoded needed:\n";
my $MaxLineLen = 1176;
print MIME::EncWords::encode_mimewords(
$value,
Encoding => 'Q',
Charset => 'UTF-8',
MaxLineLen => $MaxLineLen,
) ;
prints:
no encoded needed:
<http://example.com/a/very/long/url/that/points/to/something/important/without/any/utf-8/>