#!/usr/bin/perl # which with symlink tracing # (C) 2005 Eric L. Wilhelm use Cwd qw(abs_path); my $file = shift; $file or die "use: $0 'filename'"; if($file =~ m/::/) {# XXX really need a switch for this # XXX get rid of backticks # XXX turn lookup into a function $file = `which_module $file`; } elsif(-e $file) { # just trace? } else { $file = `which $file`; } $file = (split(/\n/, $file, 2))[0]; # just the first one # XXX add step-by-step tracing support? $file = abs_path($file); print "$file\n";