Next Program Repair Shop 78

Repeated Tests

     23    if (! -d $dst && -e $dst) {
     24      die "Can't continue because a file has target's dir name\n";
     25    } elsif ( ! -e $dst ) {
     26      mkdir $dst or die "Couldn't create dir : $target_node\n";
     27    }
     if (-e $dst) {
       die "Can't continue because a file has target's dir name\n"
         unless -d $dst
     } else {
       mkdir $dst or die "Couldn't create dir : $target_node\n";
     }
     if (-e $dst) {
       die "Can't continue because a file has target's dir name\n"
         unless -d _;
     } else {
       mkdir $dst or die "Couldn't create dir : $target_node\n";
     }


Next Copyright © 2002 M. J. Dominus