App-perlmv-u
view release on metacpan or search on metacpan
lib/App/perlmv/u.pm view on Meta::CPAN
for my $k ($src, $dest) {
unless (exists $exists{$k}) {
$exists{$k} = File::Util::Test::file_exists($k);
}
}
}
my $all_dest_exist = 1;
for (keys %dest) {
unless ($exists{$_}) { $all_dest_exist = 0; last }
}
my $all_src_not_in_dest_not_exist = 1;
for (keys %src) {
next if $dest{$_};
if ($exists{$_}) { $all_src_not_in_dest_not_exist = 0; last }
}
if ($all_dest_exist && $all_src_not_in_dest_not_exist) {
# fixed
return [304, "All sources do not exist and ".
"all targets already exist"];
}
my $all_src_exist = 1;
for (keys %src) {
unless ($exists{$_}) { $all_src_exist = 0; last }
}
my $all_dest_not_in_src_not_exist = 1;
for (keys %dest) {
next if $src{$_};
if ($exists{$_}) { $all_dest_not_in_src_not_exist = 0; last }
}
if ($all_src_exist && $all_dest_not_in_src_not_exist) {
# fixable
my @do_actions;
my @undo_actions;
my @pairs;
for my $pair (reverse @{ $args{pairs} }) {
push @pairs, [$pair->[1] => $pair->[0]];
}
push @do_actions , ['move_multiple', {pairs => $args{pairs}}];
push @undo_actions, ['move_multiple', {pairs => \@pairs}];
return [200, "OK", undef, {
( run in 0.222 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )