diff options
author | Jonas Smedegaard <dr@jones.dk> | 2021-05-20 13:02:21 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-08-27 23:39:36 +0200 |
commit | 359db04b8273c89f07ee573a460feb9891305c3e (patch) | |
tree | 55e6c4ad7232db8c96c1cc3b0040785a4ded61bc | |
parent | 55f6a9ec14e1c28763f71c53cdbfc80102435fd9 (diff) |
restructure: pass start and end times to print_event() (not whole iCal::Parser object)
-rwxr-xr-x | bin/events2md.pl | 15 |
1 files 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') } ) { |