RT3 Problem: Apache2 + mod_perl. webmux.pl problem

Hi,

I’ve got a problem with RT 3.0.2. I’m using it with Apache 2.0.46
and mod_perl 1.99

Using

PerlRequire /usr/local/rt3/bin/webmux.pl

Is giving me errors when I start Apache. I’ll paste a more detailed
explanation of configuration parameters below.

brassy# apachectl start
[Tue Jun 24 16:27:42 2003] [error] Global $r object is not
available. Set:
PerlOptions +GlobalRequest
in httpd.conf at
/usr/local/lib/perl5/site_perl/5.6.1/HTML/Mason/ApacheHandler.pm
line 573.
Compilation failed in require at (eval 7) line 1.

[Tue Jun 24 16:27:42 2003] [error] Can’t load Perl file:
/usr/local/rt3/bin/webmux.pl for server brassy.rfc-networks.ie:0,
exiting…

I’ve tried setting PerlOptions +GlobalRequest in various places
(possibly everywhere) and didn’t get much help. Googling didn’t help
much either, so perhaps someone can help me diagnose the problem.

The pertinent VirtualHost directive is as follows:

<VirtualHost *>
DocumentRoot /usr/local/rt3/share/html/

    # this line applies to Apache2+mod_perl2 only
    PerlModule Apache2 Apache::compat

    PerlModule Apache::DBI
    PerlRequire /usr/local/rt3/bin/webmux.pl

    # this section applies to Apache2+mod_perl2 only
    <FilesMatch "\.html$">
        SetHandler perl-script
        PerlHandler RT::Mason
    </FilesMatch>
    <LocationMatch "/Attachment/">
        SetHandler perl-script
        PerlHandler RT::Mason
    </LocationMatch>
    <LocationMatch "/REST/">
        SetHandler perl-script
        PerlHandler RT::Mason
    </LocationMatch>

After taking a quick look at the code, I don’t think that any
options I’ve set in RT_SiteConfig.pm are effecting this at all, but
I’ll mail that if someone thinks it would help.

HTML::Mason version 1.19.

The strange thing is that $r doesn’t seem to be a global object

I’ve pasted some of the relevant code from HTML::Mason in case this
helps anyone either. I have a strange feeling this belongs more on
rt-devel, but I thought I’d try here first.

----------------------------8<-----------------------------

sub new
{
my $class = shift;

# Get $r off end of params if its there
my $r;
$r = pop() if @_ % 2;
my %params = @_;

my %defaults;
$defaults{request_class}  =

'HTML::Mason::Request::ApacheHandler’
unless exists $params{request};
$defaults{resolver_class} =
'HTML::Mason::Resolver::File::ApacheHandler’
unless exists $params{resolver};

my $allowed_params = $class->allowed_params(%defaults, %params);

if ( exists $allowed_params->{comp_root} and  ## Line 573
     my $req = $r || Apache->request )  ## Line 574
{

---------------------------->8-----------------------------

Regards,
Philip Reynolds | RFC Networks Ltd.
philip.reynolds@rfc-networks.ie | +353 (0)1 8832063
http://people.rfc-networks.ie/~phil | www.rfc-networks.ie

Philip Reynolds philip.reynolds@rfc-networks.ie 106 lines of wisdom included:

The strange thing is that $r doesn’t seem to be a global object

I’ve pasted some of the relevant code from HTML::Mason in case this
helps anyone either. I have a strange feeling this belongs more on
rt-devel, but I thought I’d try here first.

----------------------------8<-----------------------------

if ( exists $allowed_params->{comp_root} and  ## Line 573
     my $req = $r || Apache->request )  ## Line 574
{

---------------------------->8-----------------------------

It seems to be a compatability problem between HTML::Mason and
mod_perl2. I changed the line

    my $req = $r || Apache->request )

to
my $req = $r )

and everything seems to work OK now.

Philip Reynolds | RFC Networks Ltd.
philip.reynolds@rfc-networks.ie | +353 (0)1 8832063
http://people.rfc-networks.ie/~phil | www.rfc-networks.ie

It seems to be a compatability problem between HTML::Mason and
mod_perl2. I changed the line

    my $req = $r || Apache->request )

to
my $req = $r )

and everything seems to work OK now.

You may wish to submit a patch to mason-devel@lists.sourceforge.net
folks so it reads

my $req = eval { $r } || eval { Apache->request }

or something like that…

/Autrijus/