summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-05-20 13:02:21 +0200
committerJonas Smedegaard <dr@jones.dk>2021-05-20 13:02:21 +0200
commit0f7f1df7ca760f54911453a842a79500360e65d3 (patch)
tree6cf424042b70c6264b899183f769e88b07ec98a0
parentf7694214009de69f1c8c5f5f6f3dca73f8869ca1 (diff)
restructure: pass start and end times to print_event() (not whole iCal::Parser object)
-rwxr-xr-xbin/events2md.pl15
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') } ) {