Disclaimer

The content of this blog is my personal opinion only. Although I am an employee - currently of Nvidia, in the past of other companies such as Iagination Technologies, MIPS, Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

Monday, February 01, 2016

FindBin - perldoc.perl.org

FindBin - perldoc.perl.org: "If there are two modules using FindBin from different directories under the same interpreter, this won't work. Since FindBin uses a BEGIN block, it'll be executed only once, and only the first caller will get it right. This is a problem under mod_perl and other persistent Perl environments, where you shouldn't use this module. Which also means that you should avoid using FindBin in modules that you plan to put on CPAN. "


use Dir::Self instead.



(ISSUE: Dir::Self and symlinks.)


Dir::Self - search.cpan.org

Use Dir::Self to cope with the problem that FindBin should not be called more than once in a program.



FindBin for the location of the executable to find libraries relative to the executable.



use lib "$FindBin::RealBin/lib";



Dir::Self for modules that want to load other modules relative to themselves.



use lib __DIR__;



or



use lib __DIR__ . "/..";



ISSUE: is __DIR__ symlink aware - i.e. is it the equivalent of $FindBin::Bin or $FindBin::RealBin?