The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

File::Which::Cached - faster subsequent which lookups

SYNOPSIS

   use File::Which::Cached 'which';   
   my $perl_bin = which('perl');

   use File::Which::Cached;
   my $perl_bin = File::Which::Cached::which('perl');

DESCRIPTION

This is a wrapper around File::Which that caches results to a package symbol. If you have a sub or method that makes multiple calls to which, and maybe the same executable lookup, you may want to do this.

File::Which does not cache results in the package. That means that if you call which twice for the same executable, it performs twice.

This module will save the result, so that if your code is called to lookup an executable a thousand times, it takes just as long as one time.

This is desirable in iterations of many calls, etc. In 2 thousand calls, we save one second.

SUBS

Not exported by default.

which()

Argument is name of executable, returs abs path to file. Takes one argument at a time. If you provide no argument, croaks.

SEE ALSO

File::Which

AUTHOR

Leo Charre leocharre at cpan dot org

COPYRIGHT

Copyright (c) 2009 Leo Charre. All rights reserved.

LICENSE

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".

DISCLAIMER

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the "GNU General Public License" for more details.