Subject: | directories return in resolve_filename instead of filenames |
resolve_filename can take either a filename or module. If a directory with the module name exists, then it is returned.
Example:
parent/top/top.v
Running the program in parent will return the "top" directory causing a input scanner error since it will try.
Running the program in any other directory will work. (assuming search paths are adjusted)
Solution:
Besides checking for "-r" we should make sure that it's not also a directory.
[jtseng@pagemill perl]$ diff -c Verilog-Perl-2.302/Getopt.pm Verilog-Perl-2.302-pasemi1/
*** Verilog-Perl-2.302/Getopt.pm 2004-11-10 09:56:43.000000000 -0800
--- Verilog-Perl-2.302-pasemi1/Getopt.pm 2005-01-26 14:03:55.000000000 -0800
***************
*** 309,315 ****
defined $filename or carp "%Error: Undefined filename,";
return $self->{_file_path_cache}{$filename} if defined $self->{_file_path_cache}{$filename};
! if (-r $filename) {
$self->{_file_path_cache}{$filename} = $filename;
$self->depend_files($filename);
return $filename;
--- 309,315 ----
defined $filename or carp "%Error: Undefined filename,";
return $self->{_file_path_cache}{$filename} if defined $self->{_file_path_cache}{$filename};
! if (-r $filename && (! -d $filename)) {
$self->{_file_path_cache}{$filename} = $filename;
$self->depend_files($filename);
return $filename;
***************
*** 324,330 ****
foreach my $postfix ("", @{$self->{libext}}) {
my $found = "$dir/$filename$postfix";
next if $checked{$found}; $checked{$found}=1; # -r can be quite slow
! if (-r $found) {
$self->{_file_path_cache}{$filename} = $found;
$self->depend_files($found);
return $found;
--- 324,330 ----
foreach my $postfix ("", @{$self->{libext}}) {
my $found = "$dir/$filename$postfix";
next if $checked{$found}; $checked{$found}=1; # -r can be quite slow
! if (-r $found && (! -d $found)) {
$self->{_file_path_cache}{$filename} = $found;
$self->depend_files($found);
return $found;