I ran into the same problem. Found a simpler, cleaner solution.
Just perform a

   export PERL_HTTP_URI_CLASS=URI::URL

before building mod_perl, and you're home free.

Long term, all mod_perl testing modules that "assume" URI::URL 
is loaded by LWP will now need to explicitly load URI::URL if they use it.
I suggest doing so following the loading of LWP.

Here's why it happened:

Cliff noted:
>I noticed everywhere that URI::URL  was being used in mod_perl and embperl,
>LWP::UserAgent was being used.
>
>also, i found this is the LWP (libwww-perl-5.5395) release notes:
>
>  HTTP::Request, HTTP::Response will by default now use "URI" class,
>  instead of "URI::URL", when constructing its URI objects.  This
>  has a potential for breaking existing code as URI::URL objects had
>  some extra methods that external code might depend upon.

He's right, and this is exactly what's happened in mod_perl.
It's a bug *caused* by recent changes in LWP, and not a bug in LWP, per se.
>From Gisle Aas' directory in CPAN, you can see:

04/10/01 06:15PM        157,267 libwww-perl-5.53.tar.gz
05/05/01 08:57AM        172,925 libwww-perl-5.53_94.tar.gz
08/06/01 07:46PM        174,613 libwww-perl-5.53_95.tar.gz

>From the "official" website, http://www.linpro.no/lwp, he says the
lastest version is 5.53 from 4/10/01. However, if you use the CPAN module,
you will pickup the 5.53_95 version instead. This is the version (and
maybe 5.53_94 as well, but I haven't checked) that makes mod_perl break.
Or maybe some interim versions of the CPAN module are downloading
this development version of the module, I'm not sure.

I'm willing to bet that both of you have the later 5.53_95 rev and not
the 5.53 version.

Here's the cause of the problem. Gisle has always used URI::URL for
representing his URLs within LWP. These latest revs changed that.
He now uses a base URI class. The effect of this is that LWP no longer
uses URI::URL. Meaning URI::URL is no longer 'use'd by LWP, and so
LWP will no longer automatically 'use' URI::URL and pull it in too.

This is what's making mod_perl (and any other modules that do this) break.

Using LWP *does not* load URI::URL. mod_perl's tests *assume* that just
because LWP was loaded, that URI::URL was too. And that's the hidden
dependency that's being violated here.

So, where's the root of the cause of the code breakage in LWP, you ask?

Way down in HTTP::Message (which is inherited by HTTP::Request and 
HTTP::Response), Gisle has changed it to use the bare URI class and not
the older URI::URL class.

Here's the line of code that does the damage (Line 37 in HTTP::Message.pm):

   $HTTP::URI_CLASS ||= $ENV{PERL_HTTP_URI_CLASS} || "URI";

As should be obvious now, my simple solution is to perform a

   export PERL_HTTP_URI_CLASS=URI::URL

before building mod_perl, and you're home free.

Michael King
[EMAIL PROTECTED]

---------------------------------------------
Valuenet Web Mail.
http://www.valuenet.net/


Reply via email to