[ic] Bareword error in email.tag

Josh Lavin josh at kdw.us
Fri Aug 20 17:36:47 UTC 2010


On 08/18/2010 09:34 AM, Josh Lavin wrote:
> Using the latest Interchange nightly, along with the
> MINIVEND_DISABLE_UTF8 environment variable, when starting IC the
> email.tag threw:
>
> Bareword "Encode::PERLQQ" not allowed while "strict subs" in use.
>
> I made the following change which allows Interchange to start just fine.
> Tested with a regular email, but did not test with UTF8 on...
>
> --- a/code/UserTag/email.tag
> +++ b/code/UserTag/email.tag
> @@ -23,7 +23,7 @@ BEGIN {
>
> sub utf8_to_other {
> my ($string, $encoding) = @_;
> - return $string unless defined Encode::PERLQQ; # nop if no Encode
> + return $string unless defined Encode::PERLQQ(); # nop if no Encode
>
> unless(Encode::is_utf8($string)){
> $string = Encode::decode('utf-8', $string);
>
>
> http://github.com/jlavin/interchange/commit/cc04b8d886d77b04c1f848b67401e523f2f1b26c

Additionally, I found that the latest email.tag had some changes which 
caused all plain-text emails to be MIME-encoded.

It seems that the author wanted to clear out anything in $opt->{attach}, 
but this caused plain-text emails to run through the ATTACH routine, 
making them "Content-Type: multipart/mixed".

A side effect was that if the "To" was left blank (mistakenly or from a 
UI order), an attempt was still made to deliver the message, but a blank 
"To" became a "To: ARRAY at ..." (causing bounces). The previous version of 
mail.tag did not suffer from this (I think because plain-text messages 
did not run through ATTACH), and Sendmail would fail silently (debug.log 
would report "No recipient addresses found in header").

The change below fixes both of these problems, but I don't know if the 
author had something else in mind with the line I removed. Regardless, I 
have tested this change with plain-text and HTML emails, and in my 
opinion this is a needed fix.

         # force utf8 email through MIME as attachment
         unless (($opt->{attach} || $opt->{html}) && $utf8){
-               $opt->{attach} = [()];
                 $opt->{body_mime} = $opt->{mimetype};
                 $body = utf8_to_other($body, 'utf-8');
         }


http://github.com/jlavin/interchange/commit/3f9685e0a7890f03e1f3eb4709f72ffeffff98b1

-- 
Josh Lavin
Perusion -- Expert Interchange Consulting    http://www.perusion.com/



More information about the interchange-users mailing list