Not in the list so please reply directly to me!

On Mon, 26 Apr 2004, Paulo Matos wrote:
>
> On Mon, 19 Apr 2004 Sympatico wrotes:
> >
> > At the risk of asking a trivial question.
> >
> > I just installed qpsmtpd and when I test it with a simple mail, I get an
> > error when sending the mail from: line. It seems that the 
> > Mail::Address->parse fonction croaks at line 209 of SMTP.pm. I changed 
> > the line to hardcode the $from variable (to test[at]test.com, and the 
> > whole thing went through (not very useful in real life). I fear I have a 
> > problem with my perl installation, but I am not sure what it is. I am on 
> > 5.8.0. The programs dies in a tokenise fonction of the Mail::Address 
> > module. Thanks if anyone can help.
> >
>       I'm having the exact same problem in a much more complex 
> environment (apache2 + mod_perl2). This makes me more suspicious about 
> perl 5.8.0 than Mail::Address itself... I'm using module version 1.62 and 
> I replaced directly Address.pm from version 1.58 and the problem persists.
> 
>       The most weired thing is that the parameter value seems to be ok 
> everywhere. If you make a script use the module directly or indirectly 
> (through the caller module, in your case SMTP.pm) it just works just fine.
> 

Just for the record, the cause and solution:

Mail::Address->parse($email) caused an the error (croaks):

Unrecognised line: '[EMAIL PROTECTED]'

Well it seems that perl 5.8.0-5.8.X has a problem with utf8/regexps.

The internal representation of perl strings has an UTF-8 flag associated
that can be turned off via Encode::_utf8_off($string), so a way to solve
some issues like this are to use this workaround. (see Encode
documentation for more details).

I saw postings refering that the problem may be cause by using perl with
thread support, which is not the case I tested it under perl with and
without thread support with the same results. (The stock perl shipped with
some distros are threaded enabled: e.g. RedHat 9, RHEL, WBEL...)

A generic workaround to cases like this would be to use:

Encode:_utf8_off($parameter_variable);

before calling the problematic function, which in this case is
Mail::Address->parse().

This has to be used with caution since it messes with perl internals, so
sometimes you'll have to switch the flag on after calling the function.


If there's something incorrect above please let me know!!!


Cheers,

--
        Paulo Matos
 ----------------------------------- ----------------------------------
|Sys & Net Admin                    | Serviço de Informática           |
|Faculdade de Ciências e Tecnologia | Tel: +351-21-2948596             |
|Universidade Nova de Lisboa        | Fax: +351-21-2948548             |
|P-2829-516 Caparica                | e-Mail: [EMAIL PROTECTED]          |
 ----------------------------------- ----------------------------------

Reply via email to