in reply to Re^3: Do modules know the callers full path?
in thread Do modules know the callers full path?
That's true, but it is not the whole truth. The documentation says (emphasis mine):
Which also means that you should avoid using FindBin in modules that you plan to put on CPAN.
Using FindBin in a module works fine. If you use FindBin::again();, then you are safe. The reason why one should not use it on CPAN is because other users of that module might not be aware that they also need to call FindBin::again(); in their code to be safe ... which, on close inspection, they only need for use cases like mod_perl where the "scripts" aren't actually fed to the interpreter on the command line.
While we are looking at the fine print: Like abs_path($0), FindBin relies on $0. So if used in programs which modify $0 (like e.g. plackup does), then one should hope that it does so in a sensible way.
|
|---|