projects
/
p5sagit/p5-mst-13.2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
perl 3.0 patch #12 patch #9, continued
[p5sagit/p5-mst-13.2.git]
/
eg
/
relink
1
#!/usr/bin/perl
2
3
($op = shift) || die "Usage: relink perlexpr [filenames]\n";
4
if (!@ARGV) {
5
if (-t) {
6
@ARGV = <*>;
7
}
8
else {
9
@ARGV = <STDIN>;
10
chop(@ARGV);
11
}
12
}
13
for (@ARGV) {
14
next unless -l; # symbolic link?
15
$name = $_;
16
$_ = readlink($_);
17
$was = $_;
18
eval $op;
19
die $@ if $@;
20
if ($was ne $_) {
21
unlink($name);
22
symlink($_, $name);
23
}
24
}