Don't return a literal 404. The return from a PerlResponseHandler (PerlHandler is an alias and should work) is supposed to be a constant that the apache server understands, so it should be Apache2::Const::NOT_FOUND. What you have for .mas files looks fine. Is it not working for you?