+sub iso8601 ($) { strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($_[0])) }
+
+# we open this in the parent process before ->wq_io_do handoff
+sub ovv_out_lk_init ($) {
+ my ($self) = @_;
+ my $tmp = File::Temp->new("lei-ovv.dst.$$.lock-XXXX",
+ TMPDIR => 1, UNLINK => 0);
+ $self->{"lk_id.$self.$$"} = $self->{lock_path} = $tmp->filename;
+}
+
+sub ovv_out_lk_cancel ($) {
+ my ($self) = @_;
+ my $lock_path = delete $self->{"lk_id.$self.$$"} or return;
+ unlink($lock_path);
+}
+
+sub detect_fmt ($) {
+ my ($dst) = @_;
+ if ($dst =~ m!\A([:/]+://)!) {
+ die "$1 support not implemented, yet\n";
+ } elsif (!-e $dst || -d _) {
+ 'maildir'; # the default TODO: MH?
+ } elsif (-f _ || -p _) {
+ die "unable to determine mbox family of $dst\n";
+ } else {
+ die "unable to determine format of $dst\n";
+ }
+}