perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tracy12 <>
Subject Re: Test fails/Functionality works
Date Mon, 15 Jan 2007 23:07:37 GMT

I am modifying (adding new functions) to already written perl module,

So this is not a complete new development. I am using mod_perl 2.0 /Apache
2.2 on Fedora, Looks like code is not written for this but for a older
mod_perl version less than 2.0

Error I got was
Can't locate object method "user" via package "Apache2::Connection

but  if I change it to $r->user($user) instead of
$r->connection->user($user) this looks ok but  it gives further errors
on  Can't locate object method "header_out" via package
"Apache2::RequestRec" in the line  $r->header_out->set(Location =>
$url_new); Is this needs to be changed as well.?

This all happens when I comment the line use Apache2::compat;

Good thing is make test gives zero errors.

How can I preserve existing written old code also make sure make test gives
zero errors. How can I find the corresponing mappings for old vs new perl

Even though the functionality works in my case make test fails because of
the above line Apache2::compat;


Perrin Harkins wrote:
> On Mon, 2007-01-15 at 00:51 -0800, Tracy12 wrote:
>> I found out that the reason for failure is the following line
>> use Apache2::compat;
> You didn't tell us what the error message is when you have that line in.
> Regardless, you shouldn't use Apache2::compat for new development.  It's
> meant for porting old code.
>> but when I remove this entry the make test gives no errors but
>> functionality
>> fails and in the log it says that
>>  Can't locate object method "user" via package "Apache2::Connection" at
>> /usr/lib/perl5/site_perl/5.8.8/ line 512.\n
>> which is basically   $r->connection->user($user);
>> line in the source.
> You should be using $r->user($user) there.
> - Perrin

View this message in context:
Sent from the mod_perl - General mailing list archive at

View raw message