You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Nguyen Vu Hung <vu...@cnt.mxt.nes.nec.co.jp> on 2007/08/27 11:25:58 UTC

Migrate LWP::UserAgent + HTTP::Request to mod_perl2

Hi all,

The following code run without problems under Apache 1.3.29, Perl 5.6.1,
mod_perl 1.29.

Under the new environment which is Apache 2.0.52, Perl 5.8.8, mod_perl
2.0.3 ( Cent OS 4.5 ), it won't run.

I have read through mod_perl2's compat page[1] and rename[2] page, but I
didn't find any useful information on how to get this code running under
the new environment.

Please shed me a light!

use LWP::UserAgent;
use HTTP::Request;

my $user_agent = LWP::UserAgent->new;
my $ua_request HTTP::Request->request->new($some_request});
$ua_request->content_type('application/x-www-form-urlencoded');
$ua_request->content($param);
my $rreq = $ua_request->content_ref;
$$rreq =~ s/%2F/\//g;
$req->header('Content-Length' => length($ua_request->content));
my $respond = $user_agent->request($ua_request);

unless ($respond->is_success) {
# $respond failed HERE! why?
}

[1] http://perl.apache.org/docs/2.0/user/porting/compat.html
[2] http://perl.apache.org/docs/2.0/rename.html

Re: Migrate LWP::UserAgent + HTTP::Request to mod_perl2

Posted by Perrin Harkins <pe...@elem.com>.
On 8/27/07, Nguyen Vu Hung <vu...@cnt.mxt.nes.nec.co.jp> wrote:
> The following code run without problems under Apache 1.3.29, Perl 5.6.1,
> mod_perl 1.29.
>
> Under the new environment which is Apache 2.0.52, Perl 5.8.8, mod_perl
> 2.0.3 ( Cent OS 4.5 ), it won't run.

There is no mod_perl-related code in what you're showing, so it
doesn't seem like a mod_perl problem.  The problem may be related to
the version of Perl you have or the version of LWP.  Try upgrading
your modules.

- Perrin

Re: Migrate LWP::UserAgent + HTTP::Request to mod_perl2

Posted by Foo JH <jh...@extracktor.com>.
What's the error msg you see?

Nguyen Vu Hung wrote:
> Hi all,
>
> The following code run without problems under Apache 1.3.29, Perl 5.6.1,
> mod_perl 1.29.
>
> Under the new environment which is Apache 2.0.52, Perl 5.8.8, mod_perl
> 2.0.3 ( Cent OS 4.5 ), it won't run.
>
> I have read through mod_perl2's compat page[1] and rename[2] page, but I
> didn't find any useful information on how to get this code running under
> the new environment.
>
> Please shed me a light!
>
> use LWP::UserAgent;
> use HTTP::Request;
>
> my $user_agent = LWP::UserAgent->new;
> my $ua_request HTTP::Request->request->new($some_request});
> $ua_request->content_type('application/x-www-form-urlencoded');
> $ua_request->content($param);
> my $rreq = $ua_request->content_ref;
> $$rreq =~ s/%2F/\//g;
> $req->header('Content-Length' => length($ua_request->content));
> my $respond = $user_agent->request($ua_request);
>
> unless ($respond->is_success) {
> # $respond failed HERE! why?
> }
>
> [1] http://perl.apache.org/docs/2.0/user/porting/compat.html
> [2] http://perl.apache.org/docs/2.0/rename.html
>