[Rt-devel] modperl2: Scope problem or perl 5.8.0?

Paulo Matos pjsm at fct.unl.pt
Tue Apr 27 15:13:47 EDT 2004

On Mon, 26 Apr 2004, Paulo Matos wrote:

> On Mon, 26 Apr 2004, Paulo Matos wrote:
> > Everything goes fine... if I don't then I get an:
> > 
> > Unrecognised line: Jesse Vincent <joedoe at domain.com> at /usr/lib/rt/RT/EmailParser.pm line 406
> > 
> > I've gone deep until Mail::Address code itself and the parameter value 
> > seems to be correct all the way. I test the perl code inside a script and 
> > it runs ok. 
> I found the same problem with an entire different setup at:
> http://www.nntp.perl.org/group/perl.qpsmtpd/1226
> I tested it with Mail::Address 1.58 and 1.62 same behavior. The most 
> weired thing it that it works running a script from command-line calling 
> directly and indirectly (through RT::EmailParser::ParseAddressFromHeader), 
> hardcoding the $email variable...
> It does not work even reimplementing the ParseAddressFromHeader locally at 
> User_Overlay.pm....
> Any hints? I'm getting mad with this one...

Just for the record, the cause and solution:

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

Unrecognised line: 'foo at mydomain.com'

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: 


before calling the problematic function, which in this case is 

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!!!


	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: pjsm at fct.unl.pt          |
 ----------------------------------- ----------------------------------

More information about the Rt-devel mailing list