Closed ppisar closed 8 years ago
From dc8eec44db151c99020cb5df192831b2f0098b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 25 May 2016 15:08:16 +0200 Subject: [PATCH] Use Error instead of TryCatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TryCatch does not work with perl-5.24.0 because of broken Scope::Upper (CPAN RT#114033). This patch rewrites the tests to use Error instead of the TryCatch. Signed-off-by: Petr Písař <ppisar@redhat.com> --- Makefile.PL | 1 - t/parser-turtle-2013.t | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 048f863..aec6bfe 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -13,7 +13,6 @@ build_requires 'Test::More' => 0.88; build_requires 'Test::Deep' => 0; build_requires 'Test::Exception' => 0; build_requires 'Test::JSON' => 0; -build_requires 'TryCatch' => 0; perl_version '5.010'; diff --git a/t/parser-turtle-2013.t b/t/parser-turtle-2013.t index 8ddbfcf..3b684cf 100644 --- a/t/parser-turtle-2013.t +++ b/t/parser-turtle-2013.t @@ -9,7 +9,7 @@ use Data::Dumper; use RDF::Trine qw(iri literal); use RDF::Trine::Namespace qw(rdf); use URI::file; -use TryCatch; +use Error ':try'; my $mf = RDF::Trine::Namespace->new('http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#'); my $rdft = RDF::Trine::Namespace->new('http://www.w3.org/ns/rdftest#'); @@ -94,10 +94,11 @@ foreach my $manifest (@manifests) { my $parsed = 1; try { $parser->parse_file_into_model( $tbase, $fh, $model ); - } catch (RDF::Trine::Error $e) { + } catch RDF::Trine::Error with { + my $e = shift; $parsed = 0; - warn "Failed to parse $file: " . $e->text; - } + warn "Failed to parse $file: " . $e->{text}; + }; if ($parsed) { compare($model, URI->new($res_file->uri), $base, $test); } else { @@ -146,7 +147,7 @@ sub compare { my $tbase = URI->new_abs( $name, $base->uri_value )->as_string; my $file = $url->file; open( my $fh, '<:encoding(UTF-8)', $file ); - try { + eval { $parser->parse_file_into_model( $tbase, $fh, $emodel ); }; -- 2.5.5
Thanks!