<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Plack::Handler::Apache2::Registry;
use strict;
use warnings;
use Try::Tiny;
use Apache2::Const;
use Apache2::Log;
use parent qw/Plack::Handler::Apache2/;

sub handler {
    my $class = __PACKAGE__;
    my ($r) = @_;

    return try {
        my $app = $class-&gt;load_app( $r-&gt;filename );
        $class-&gt;call_app( $r, $app );
    }catch{
        if(/no such file/i){
            $r-&gt;log_error( $_ );
            return Apache2::Const::NOT_FOUND;
        }else{
            $r-&gt;log_error( $_ );
            return Apache2::Const::SERVER_ERROR;
        }
    };
}

# Overriding
sub fixup_path {
    my ($class, $r, $env) = @_;
    $env-&gt;{PATH_INFO} =~ s{^$env-&gt;{SCRIPT_NAME}}{};
}

1;

__END__

=head1 NAME

Plack::Handler::Apache2::Registry - Runs .psgi files.

=head1 SYNOPSIS

  PerlModule Plack::Handler::Apache2::Registry;
  &lt;Location /psgi-bin&gt;
  SetHandler modperl
  PerlHandler Plack::Handler::Apache2::Registry
  &lt;/Location&gt;

=head1 DESCRIPTION

This is a handler module to run any *.psgi files with mod_perl2,
just like ModPerl::Registry.

=head1 AUTHOR

Masahiro Honma E&lt;lt&gt;hiratara@cpan.orgE&lt;gt&gt;

=head1 SEE ALSO

L&lt;Plack::Handler::Apache2&gt;

=cut

</pre></body></html>