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 ($$$$$$) {