From 1f55b78af5a395469888871d20994e2daad1a816 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Fri, 29 Nov 2013 16:27:00 -0500 Subject: [PATCH] use strict/warnings and fix bug that was obvious once used. --- calendar-export.plx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/calendar-export.plx b/calendar-export.plx index 64a8acb..22bc3f0 100755 --- a/calendar-export.plx +++ b/calendar-export.plx @@ -67,6 +67,9 @@ # You should have received a copy of the GNU General Public License, # version 3. If not, see +use strict; +use warnings; + use POSIX ":sys_wait_h"; use Fcntl; # for sysopen use Carp; @@ -396,14 +399,14 @@ END_ICAL } $newCalendar->add_entry($entry); } + open(SCRUBBED_CAL, ">$file") or + DieLog("Unable to overwrite $file: $!", $LOCK_CLEANUP_CODE); + print SCRUBBED_CAL $newCalendar->as_string; + close SCRUBBED_CAL; + DieLog("Error when writing $file: $!", $LOCK_CLEANUP_CODE) + unless $? == 0; + undef $newCalendar; } - open(SCRUBBED_CAL, ">$file") or - DieLog("Unable to overwrite $file: $!", $LOCK_CLEANUP_CODE); - print SCRUBBED_CAL $newCalendar->as_string; - close SCRUBBED_CAL; - DieLog("Error when writing $file: $!", $LOCK_CLEANUP_CODE) - unless $? == 0; - undef $newCalendar; } ###################################################################### sub PrivatizeMergeAndTZIcalFile ($$$$$$) {