+ if (my $symlinks = $self->{-ent}->{symlinks}) {
+ my $top = File::Spec->rel2abs($self->{dst});
+ for my $p (@$symlinks) {
+ my $ln = "$top/$p";
+ $ln =~ tr!/!/!s;
+ my (undef, $dn, $bn) = File::Spec->splitpath($ln);
+ File::Path::mkpath($dn);
+ my $tgt = "$top/$key";
+ $tgt = File::Spec->abs2rel($tgt, $dn);
+ if (lstat($ln)) {
+ if (-l _) {
+ next if readlink($ln) eq $tgt;
+ unlink($ln) or die "unlink($ln): $!";
+ } else {
+ push @{$self->{chg}->{badlink}}, $p;
+ }
+ }
+ symlink($tgt, $ln) or die "symlink($tgt, $ln): $!";
+ }
+ }