From ca646c688ee341314518198edc26212bd2c337ef Mon Sep 17 00:00:00 2001 From: Jens Steidl <Jens.Steidl@slub-dresden.de> Date: Fri, 9 Apr 2021 13:41:50 +0200 Subject: [PATCH] - refactor: use eval to reduce library dependencies --- bin/slubsipbuilderbagit.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl index 956165c..758225a 100644 --- a/bin/slubsipbuilderbagit.pl +++ b/bin/slubsipbuilderbagit.pl @@ -68,7 +68,6 @@ package SLUB::LZA::SIPBuilderBagIt; use MARC::Record; use Path::Tiny; use Term::ANSIColor; # colored print - use Try::Tiny; use XML::LibXML; use XML::XPath; @@ -327,12 +326,13 @@ package SLUB::LZA::SIPBuilderBagIt; my $parser = XML::LibXML->new; my $doc = $parser->parse_file($rightsFilePath); - my $success = try { $schema->validate($doc); 1 } catch {}; - if ($success) { - return 1; - } else { + eval { + $schema->validate($doc); + }; + if ($@) { # error die "File $rightsName failed validation: $@"; }; + return 1; } sub print_scalar_data($$$$){ -- GitLab