Relevant info:

Apache: 1.3.12
mod_perl: 1.24
Perl: 5.00503
gcc 2.95.1 on Linus 2.2.18pre19


I created a module that contains custom configs with the following code:

package HTML::Mason::Dispatcher;

use ExtUtils::MakeMaker;
use Apache::ExtUtils;
use Apache::src;

my @directives = ( { name => 'MasonCompRoot',
                     errmsg => 'The directory that is the Mason component
root',
                     args_how => 'TAKE1',
                     req_override => 'RSRC_CONF',
                   },
                   { name => 'MasonDataDir',
                     errmsg => 'The Mason data directory',
                     args_how => 'TAKE1',
                     req_override => 'RSRC_CONF',
                   },
                   { name => 'MasonArgsMethod',
                     errmsg => 'The method used to process arguments (CGI.pm or 
mod_perl)',
                     args_how => 'TAKE1',
                     req_override => 'RSRC_CONF',
                   },
                 );

local $^W;
Apache::ExtUtils::command_table(\@directives);

WriteMakefile( NAME    => 'HTML::Mason::Dispatcher',
               VERSION_FROM => 'Dispatcher.pm',
               INC => Apache::src->new->inc,
             );

----------------------------------------------------

The Dispatcher.pm files contains the following code:

package HTML::Mason::Dispatcher;

use strict;

use Apache::ModuleConfig ();
use DynaLoader ();
use HTML::Mason;

use vars qw($VERSION $AH @ISA);

$VERSION = '0.01';

@ISA = qw(DynaLoader);

use constant DEBUG => 1;

__PACKAGE__->bootstrap($VERSION) if $ENV{MOD_PERL};

sub MasonCompRoot ($$$)
{
    my ($cfg, $params, $comp_root) = @_;
    $cfg->{Mason}{comp_root} = $comp_root;
}

sub MasonDataDir ($$$)
{
    my ($cfg, $params, $data_dir) = @_;
    $cfg->{Mason}{data_dir} = $data_dir;
}

sub MasonArgsMethod ($$$)
{
    my ($cfg, $params, $method) = @_;
    unless ( $method eq 'CGI' || $method eq 'mod_perl' )
    {
        die "Invalid MasonArgsMethod param: $method\n";
    }
    eval "use HTML::Mason::ApacheHandler ( args_method => '$method' )";
    die $@ if $@;
}

sub handler
{
    eval "use HTML::Mason::ApacheHandler;" unless $HTML::Mason::ApacheHandler::VERSION;

    my $r = shift;
    unless ($AH)
    {
        my $cfg = Apache::ModuleConfig->get($r);
        my $interp = HTML::Mason::Interp->new( parser => HTML::Mason::Parser->new,
                                               comp_root => $cfg->{Mason}{comp_root},
                                               data_dir => $cfg->{Mason}{data_dir} );
        $AH = HTML::Mason::ApacheHandler( interp => $interp );
    }

    return $AH->handle_request($r);
}

----------------------------------------------

My config file contains the following:


<Perl>
use lib '/home/autarch/mason-CVS/mason/dist/lib';
</Perl>
PerlModule HTML::Mason::Dispatcher

MasonCompRoot /usr/local/apache/htdocs
MasonDataDir /usr/local/apache_mp/mason
MasonArgsMethod mod_perl

<FilesMatch "\.mhtml$">
    SetHandler perl-script
    PerlHandler HTML::Mason::Dispatcher
</FilesMatch>

-----------------------------------------------

Anyway, the configuration directives piece works fine.  I added warn
statements in the relevant functions and it confirmed that were indeed
being called with the correct values.

However, when I make a request to a URL that would call the handler
method, I get a segmentation fault.

I recompiled mod_perl with tracing and set MOD_PERL_TRACE=all.  The trace
was pretty uninteresting.  Here's what I got when starting the server:

perl_parse args: '-w' '/dev/null' ...allocating perl interpreter...ok
constructing perl interpreter...ok
ok
running perl interpreter...ok
mod_perl: 0 END blocks encountered during server startup
loading perl module 'Apache'...loading perl module
'Apache::Constants::Exports'...ok
ok
loading perl module 'Tie::IxHash'...ok
perl_section: </Files>
perl_section: </Directory>
perl_section: </Files>
perl_section: </Directory>
perl_section: </VirtualHost>
perl_section: </Location>
perl_section: </Location>
loading perl module 'Apache'...ok
PerlModule: arg='HTML::Mason::Dispatcher'
loading perl module 'HTML::Mason::Dispatcher'...ok
bootstrapping <Perl> sections: arg=HTML::Mason::Dispatcher, keys=10
loading perl module 'Apache'...ok
loading perl module 'Tie::IxHash'...ok
perl_section: </Files>
perl_section: </Directory>
perl_section: </Files>
perl_section: </Directory>
perl_section: </VirtualHost>
perl_section: </Location>
perl_section: </Location>
mod_perl: delete $INC{'HTML/Mason/Dispatcher.pm'} (klen=24)
blessing cmd_parms=(0xbffffab4)
blessing cmd_parms=(0xbffffab4)
blessing cmd_parms=(0xbffffab4)
init `PerlHandler' stack
perl_cmd_push_handlers: @PerlHandler, 'HTML::Mason::Dispatcher'
pushing `HTML::Mason::Dispatcher' into `PerlHandler' handlers

----------------------------------------

And here's what's in the error_log file:

`PerlRestartHandler' push_handlers() stack is empty
PerlRestartHandler handlers returned -1
[Wed Nov 29 02:40:08 2000] [notice] Apache/1.3.12 (Unix) mod_perl/1.24 configured -- 
resuming normal operations
perl_init_ids: uid=500, euid=500, gid=100, egid=100
`PerlChildInitHandler' push_handlers() stack is empty
PerlChildInitHandler handlers returned -1
perl_init_ids: uid=500, euid=500, gid=100, egid=100
`PerlChildInitHandler' push_handlers() stack is empty
PerlChildInitHandler handlers returned -1
`PerlInitHandler' push_handlers() stack is empty
PerlInitHandler handlers returned -1
`PerlPostReadRequestHandler' push_handlers() stack is empty
PerlPostReadRequestHandler handlers returned -1
[Wed Nov 29 02:40:30 2000] [notice] child pid 12127 exit signal
Segmentation fault (11)
perl_init_ids: uid=500, euid=500, gid=100, egid=100
`PerlChildInitHandler' push_handlers() stack is empty
PerlChildInitHandler handlers returned -1


Help would be appreciated.


-dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to