ruz / HTML-Mason-PSGIHandler

PSGI handler for Mason
http://search.cpan.org/dist/HTML-Mason-PSGIHandler
3 stars 4 forks source link

Implement `prepare_psgi` #16

Open KES777 opened 9 years ago

KES777 commented 9 years ago

Please implement prepare_psgi this will give programmers a chance to handle 404 errors. With Html::Mason::ApacheHandler I could:

            $req =  $ah{ $r->hostname }->prepare_request( $r );
            if( ref $req ) {
                my $status =  $req->exec;
                $r->log->info( "Execution status: $status " .$r->uri )   if !($status ~~ [ 0, 302 ]);
                return $status || Apache2::Const::OK;
            }
            else {
                if( $req == 404 ) {
                    $r->log->error( $req .' Page not found ' .$r->uri );
                    my $url = $r->construct_url( '/' );
                    $r->headers_out->set( Location => $url );
                    return Apache2::Const::REDIRECT;
                }

                die "Unrecognized return code: $req";
            }
            $req =  $ah{ $r->hostname }->prepare_psgi( $env );
            if( ref $req ) {
                my $status =  $req->exec;
                                ...

With this module I couldnot (

plicease commented 8 years ago

I agree, this module is mostly useless to me without handling 404 errors correctly.