my ($lei, $dst) = @_;
if ($dst =~ m!\A([:/]+://)!) {
$lei->fail("$1 support not implemented, yet\n");
- } elsif (!-e $dst) {
- 'maildir'; # the default
+ } elsif (!-e $dst || -d _) {
+ 'maildir'; # the default TODO: MH?
} elsif (-f _ || -p _) {
$lei->fail("unable to determine mbox family of $dst\n");
- } elsif (-d _) { # TODO: MH?
- 'maildir';
} else {
$lei->fail("unable to determine format of $dst\n");
}
"$dst exists and is not a directory\n";
$lei->{ovv}->{dst} = $dst .= '/' if substr($dst, -1) ne '/';
} elsif (substr($fmt, 0, 4) eq 'mbox') {
- -e $dst && !-f _ && !-p _ and die
- "$dst exists and is not a regular file\n";
+ (-d $dst || (-e _ && !-w _)) and die
+ "$dst exists and is not a writable file\n";
$self->can("eml2$fmt") or die "bad mbox --format=$fmt\n";
$self->{base_type} = 'mbox';
} else {
is($? >> 8, 1, 'errored out with exit 1');
ok(!$lei->(qw(q s:prefix -f mboxcl2 -o), $home), 'bad mbox');
- like($err, qr!\Q$home\E exists and is not a regular file!,
+ like($err, qr!\Q$home\E exists and is not a writable file!,
'error shown');
is($? >> 8, 1, 'errored out with exit 1');