http://qs321.pair.com?node_id=1217284


in reply to Re: Overloading Weirdness
in thread Overloading Weirdness

"." means the current work directory, not the script's directory.

use lib qw(.);
should be
use FindBin qw( $RealBin ); use lib $RealBin;

Replies are listed 'Best First'.
Re^3: Overloading Weirdness
by Athanasius (Archbishop) on Jun 24, 2018 at 04:11 UTC

    Hello ikegami,

    Thanks for that! I had a hard time trying to think of a situation in which the current working directory would be different to the script’s directory (in the absence of explicit calls to chdir, of course). Finally, the penny dropped: if I invoke a script foo/bar/baz.pl from the foo directory:

    perl bar/baz.pl

    the script’s directory is foo/bar, but the current working directory is still foo!

    Thanks again,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      Yes, relpath/prog[1] and /abspath/prog[2], but even just prog[3]

      1. If relpath doesn't refer to the CWD.
      2. If /abspath doesn't refer to the CWD.
      3. If the $PATH entry used doesn't refer to the CWD.
Re^3: Overloading Weirdness
by pudge (Sexton) on Jun 23, 2018 at 21:18 UTC
    Regardless, if the difference is that the class is in a separate file, that would be super weird.