From 0f7f1df7ca760f54911453a842a79500360e65d3 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 20 May 2021 13:02:21 +0200 Subject: restructure: pass start and end times to print_event() (not whole iCal::Parser object) --- bin/events2md.pl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/events2md.pl b/bin/events2md.pl index 282afa8..89bf43f 100755 --- a/bin/events2md.pl +++ b/bin/events2md.pl @@ -160,7 +160,8 @@ for my $year ( map { $_->value } { print_event( $calendar_entries{VEVENT}{ $_->key }, - $_->value, + $_->value->{DTSTART}, + $_->value->{DTEND}, $output_path, ); } @@ -170,12 +171,14 @@ for my $year ( map { $_->value } sub print_event { - my ( $entry, $event, $path ) = @_; + my ( $entry, $start, $end, $path ) = @_; if ( $log->is_trace ) { use DDP; p $entry; - p $event; + p $start; + p $end; + p $path; } my $summary = get_property_string( $entry, 'summary' ); my $description = get_property_string( $entry, 'description' ); @@ -189,9 +192,9 @@ sub print_event } } my $location = get_property_string( $entry, 'location' ); - my $time_begin = ucfirst( $event->{DTSTART}->strftime('%A') ); - $time_begin .= $event->{DTSTART}->strftime(' %e. %B kl. %k.%M'); - my $time_end = $event->{DTEND}->strftime('%k.%M'); + my $time_begin = ucfirst( $start->strftime('%A') ); + $time_begin .= $start->strftime(' %e. %B kl. %k.%M'); + my $time_end = $end->strftime('%k.%M'); my %attachments; if ( $entry->property('attach') ) { for ( @{ $entry->property('attach') } ) { -- cgit v1.2.3