diff options
author | Jonas Smedegaard <dr@jones.dk> | 2021-05-20 13:02:21 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2021-05-20 13:02:21 +0200 |
commit | 0f7f1df7ca760f54911453a842a79500360e65d3 (patch) | |
tree | 6cf424042b70c6264b899183f769e88b07ec98a0 /bin | |
parent | f7694214009de69f1c8c5f5f6f3dca73f8869ca1 (diff) |
restructure: pass start and end times to print_event() (not whole iCal::Parser object)
Diffstat (limited to 'bin')
-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') } ) { |