diff options
author | Jonas Smedegaard <dr@jones.dk> | 2023-08-13 11:57:17 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-08-27 23:39:36 +0200 |
commit | 4b0646e611b197d353004c37bb11e1e9f250b223 (patch) | |
tree | 2b5de9715d4d12ed5c02d06591a4b9d4d453c4da | |
parent | a2a6fd1ac47decc42f21a4a27702640dbd5287d5 (diff) |
use Feature::Compat::Try (not Try::Tiny); log failure to parse URI
-rwxr-xr-x | bin/events2md.pl | 10 |
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; |