[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: Perlhandler bugs when set up on the root of the domain
From:       Torsten_Förtsch <torsten.foertsch () gmx ! net>
Date:       2012-06-12 13:41:08
Message-ID: 4FD746F4.2040903 () gmx ! net
[Download RAW message or body]

On 06/12/2012 03:01 PM, David Levy wrote:
> Hi everyone,
> 
> i've start working with mod_perl and perlhandler few weeks ago in a
> folder of my domain (mydomain.com/folder/) and everything was fine.
> 
> I've recently tried to set it up on the root of my domain, but now, i've
> got an error 500 when i try to go to mydomain.com and the logs says :
> 
>  Can't locate object method "content_type" via package
> "Apache2::RequestRec" at /usr/lib/perl5/...
> 
> And if i add use Apache2::RequestRec after my package definition the
> error change from content_type to print.
> The test code is really simple :
> package test2::Rules2;
> use Apache2::Const qw(:common);
> 
> sub handler {
> my $r = shift;
> $r->content_type("text/plain");
> $r->print("mod_perl rules!\n");
> return OK;
> }
> 1;
> 
> Any idea on where it comes from?

Don't know why it *had* worked, but

  use Apache2::RequestRec ();     # pulls in content_type()
  use Apache2::RequestIO ();      # pulls in print()

is missing here.

One of the first things I did several years ago when I started with
modperl2 was to define this bash alias:

  alias mp2lookup='perl -MModPerl::MethodLookup -e print_method'

Now, if I don't know which module defines which method I can ask:

$ mp2lookup print
There is more than one class with method 'print'
try one of:
        use Apache2::Filter ();
        use Apache2::RequestIO ();

Torsten
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic