Bug 17600: Standardize our EXPORT_OK
[koha-ffzg.git] / opac / errors / 404.pl
index 3ce9105..1814e9d 100755 (executable)
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 
-use strict;
-use warnings;
-
+use Modern::Perl;
 use CGI qw ( -utf8 );
-use C4::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_with_http_headers );
 use C4::Context;
+use List::MoreUtils qw( any );
 
-my $query = new CGI;
+my $query = CGI->new;
 my $admin = C4::Context->preference('KohaAdminEmailAddress');
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
-        template_name   => "errors/404.tt",
+        template_name   => "errors/errorpage.tt",
         query           => $query,
         type            => "opac",
         authnotrequired => 1,
-        debug           => 1,
     }
 );
-$template->param( admin => $admin );
-output_html_with_http_headers $query, $cookie, $template->output, '404 Not Found';
+$template->param (
+    admin => $admin,
+    errno => 404,
+);
+my $status = '404 Not Found';
+if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
+    $status = '200 OK';
+}
+output_with_http_headers $query, $cookie, $template->output, 'html', $status;