From 4b0646e611b197d353004c37bb11e1e9f250b223 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 13 Aug 2023 11:57:17 +0200 Subject: use Feature::Compat::Try (not Try::Tiny); log failure to parse URI --- bin/events2md.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/events2md.pl b/bin/events2md.pl index 9c10ce0..32e057d 100755 --- a/bin/events2md.pl +++ b/bin/events2md.pl @@ -5,6 +5,7 @@ use utf8; use open qw(:std :encoding(UTF-8)); use strictures; use autodie; +use Feature::Compat::Try; use POSIX qw(locale_h); use locale; @@ -21,7 +22,6 @@ use IO::Prompter; use Cal::DAV; use Data::ICal::DateTime; use DateTime; -use Try::Tiny; use Path::Tiny; if ( IO::Interactive::Tiny::is_interactive() ) { @@ -182,8 +182,12 @@ sub print_event my %attachments; if ( $entry->property('attach') ) { for ( @{ $entry->property('attach') } ) { - my $uri = try { URI->new( $_->value ) } - or next; + my $uri; + try { $uri = URI->new( $_->value ) } + catch ($e) { + $log->errorf( 'failed to parse URI %s: %s', $uri, $e ); + next; + } $uri->authority and $uri->host or next; push @{ $attachments{ $uri->host } }, $uri; -- cgit v1.2.3