i've got an ~15year old Perl-Application. The application runs on Apache, example-code looks like:
use Apache2::RequestUtil ();
use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK);
sub handler {
my $r = shift;
Apache2::RequestUtil->request($r)
$r->subprocess_env;
$r = Apache2::RequestUtil->request;
$r->content_type("text/html");
$r->print("Hello World");
};
return Apache2::Const::OK;
}
1;
This works, but now I want to use Mojolicious for my new functionalily of this application. But how can I integrate Mojolicious to this app? When I do the following
use Apache2::RequestUtil ();
use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK);
sub handler {
my $r = shift;
Apache2::RequestUtil->request($r
$r->subprocess_env;
$r = Apache2::RequestUtil->request;
get '/:foo' => sub {
my $self = shift;
my $foo = $self->param('foo');
$self->render(text => "Hello from $foo.");
};
return Apache2::Const::OK;
}
app->start;
1;
I get a blank page. Is it possible to integrate Mojo to my app at all?
getfunction? Mojolicious has a way to interface to mod_perl. I don't know how it works, but there is documentation. I suspect it works through PSGI. You would probably make your new functionality into a separate app that could go into its own file(s), load it here, and use it. - simbabque