I'd suggest something like:
$uuencode = "begin 644 -\n";
while ($raw_edid =~ m/\G(.{1,45})/sgc) {
$uuencode .= pack("u", $1);
}
$uuencode .= "`\nend";
to generate the UUencoded string (adapted from Convert::UU)
and:
if (!$base64) {
$base64 = "";
my ($string, $mod3, $enc);
$raw_edid = $raw_edid . "";
while ($raw_edid =~ m/\G(.{1,45})/sgc) {
$string = $1;
$mod3 - length($string) % 3;
$string .= "\0", $mod3 -= 3 if $mod3;
$enc = pack("u", $string);
$enc =~ s/.//;
$enc =~ tr#`!-_#A-Za-z0-9+/#;
substr($enc, $mod3) =~ tr/A/=/;
$base64 .= $enc;
}
}
to replace the use of uuencode to generate the Base64-encoded string -
if anyone cares about the possible absence of MIME::Base64 these days.
That (Screen.pm) isn't the only use of uuencode; I think I saw one
other. Will be worth replacing that too just for efficiency, even if
there's no chance of problems passing input to it.
Cheers,
Nick
--
Nick Phillips / +64 3 479 4195 / [email protected]
Faculty of Medicine, University of Otago