diff --git a/lib/File/Which.pm b/lib/File/Which.pm index 69e1abc..f17286f 100644 --- a/lib/File/Which.pm +++ b/lib/File/Which.pm @@ -131,6 +131,10 @@ sub new { $self->{PATHEXT} = $self->_default_pathext; + if( exists $opts{fixed_paths} ) { + $self->{fixed_paths} = $opts{fixed_paths}; + } + $self; } @@ -249,7 +253,9 @@ sub which { return $exec ## no critic (ValuesAndExpressions::ProhibitMixedBooleanOperators) if !$self->_is_vms and !$self->_is_mac and !$self->_is_win and $exec =~ /\// and -f $exec and -x $exec; - my @path = @{ $self->_default_path }; + my @path = exists $self->{fixed_paths} + ? @{ $self->{fixed_paths} } + : @{ $self->_default_path }; my @PATHEXT = @{ $self->{PATHEXT} }; foreach my $base ( map { File::Spec->catfile($_, $exec) } @path ) {