#! /usr/bin/perl -w use strict; use Getopt::Long; sub findFile { my ($file, $dirs)= @_; my @dirs= split (':', $dirs); my @result= (); foreach my $dir (@dirs) { if (-f "$dir/$file") { push (@result, "$dir/$file"); } } return join (" ", @result); } my $include_path; GetOptions('include-path=s' => \$include_path); $include_path= $include_path? $include_path: '.'; my $neb= shift @ARGV; while ($neb) { $neb=~ /(.*?)\.neb/; my $gfd= "$1.gfd"; open (FILE, $neb) or die "$neb doesn't exist!"; while () { /neb:Sub .*neb:src="(.*?)"/ and print "$gfd: ".findFile ($1, $include_path)."\n"; /^\s*use (.*);$/ and print "$gfd: ".findFile ("$1.pm", $include_path)."\n"; } $neb= shift @ARGV; }