summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-08-13 11:57:17 +0200
committerJonas Smedegaard <dr@jones.dk>2024-03-10 09:17:24 +0100
commitcd39ccc5a2a5f03390fbc2d2bc0bb574e65d6ea8 (patch)
treeba8a461d7094d892d958a63b1ee566ff7875ddce
parent07d4c01652c3b3f72205e552e8dd8d543942e72b (diff)
use Feature::Compat::Try (not Try::Tiny); log failure to parse URI
-rwxr-xr-xbin/events2md.pl10
1 files 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;