in reply to Re^3: Following symlinks manually
in thread Following symlinks manually
A cursory glance at File::Spec::Link says it probably will work. I'll go away now to test it. Thanks. I searched CPAN, but coming up with the right search terms is always key!
(...)
Yes, that looks right. I think my solution is something like this:
Thanks!use File::Spec::Link; my $curlink = shift; my $linkto; while ( ($linkto = readlink($curlink)) and $linkto =~ m:^S/: ) { print "from $curlink "; $curlink = File::Spec::Link->linked($curlink); print "to $curlink\n"; } if (-l $curlink) { # do stuff with readlink($curlink) } else { # do stuff with $curlink (now a file) }
|
|---|