ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / opac / unapi
index d06fa44..fb5ce0f 100755 (executable)
@@ -17,8 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 =head1 NAME
 
@@ -129,27 +128,27 @@ if (not defined $format) {
         my $biblionumber = $1;
 
         my $content;
-        eval {
-            my $marcxml = GetXmlBiblio($biblionumber);
-            unless (defined $marcxml) {
-                # no bib, so 404
-                print $cgi->header( -status => '404 record not found');
-                exit 0;
-            }
-
-            my $xslt_file = get_xslt_file( $format, $format_to_stylesheet_map, $format_info );
-            unless( defined $xslt_file ) {
-                print $cgi->header( -status => '406 invalid format requested' );
-                exit 0;
-            }
-            my $xslt_engine = Koha::XSLT_Handler->new;
-            $content = $xslt_engine->transform({
-                xml => $marcxml,
-                file => $xslt_file,
-            });
-        };
-        if ($@) {
-            print $cgi->header( -status => '500 internal error ' . $@ );
+
+        my $marcxml = GetXmlBiblio($biblionumber);
+        unless (defined $marcxml) {
+            # no bib, so 404
+            print $cgi->header( -status => '404 record not found');
+            exit 0;
+        }
+
+        my $xslt_file = get_xslt_file( $format, $format_to_stylesheet_map, $format_info );
+        unless( defined $xslt_file ) {
+            print $cgi->header( -status => '406 invalid format requested' );
+            exit 0;
+        }
+        my $xslt_engine = Koha::XSLT_Handler->new;
+        $content = $xslt_engine->transform({
+            xml => $marcxml,
+            file => $xslt_file,
+        });
+
+        if( !defined $content || $xslt_engine->err ) {
+            print $cgi->header( -status => '500 internal error' );
             exit 0;
         }