| | 229 | SYMLINK: { |
| | 230 | if (! -l $src) { last SYMLINK; } |
| | 231 | |
| | 232 | # check if the *system* supports symbolic linking |
| | 233 | use Config; |
| | 234 | if (! ($Config{d_symlink} && $Config{d_readlink})) { last SYMLINK; } |
| | 235 | |
| | 236 | # copy as symbolic link; |
| | 237 | # be extra cautious about existence of symlinks |
| | 238 | # on a given OS |
| | 239 | use Errno; |
| | 240 | if(! exists $!{EPERM}) { last SYMLINK; } # Doesn't seem to support this |
| | 241 | my $symlink_exists = eval { |
| | 242 | symlink(readlink($src), $dest); 1; |
| | 243 | }; |
| | 244 | $@ and die $@; |
| | 245 | if (! $symlink_exists) { |
| | 246 | if($!{EPERM}) { |
| | 247 | warn "Warning: filesystem does not support symbolic links!\n"; |
| | 248 | last SYMLINK; |
| | 249 | } |
| | 250 | die "Error copying symlink: $!"; |
| | 251 | } |
| | 252 | print "$dest\n"; |
| | 253 | next FILE; |
| | 254 | } |