in reply to Re^3: Do modules know the callers full path?
in thread Do modules know the callers full path?

I finally changed dir and can now see what you mean! Scary. Of all the things I was trying only abs_path($0) and abs_path((caller)[1]) DWIM. Didn't realize I was opening Pandora's Box. It's fun watching you guys hash it out though, and have more interesting nodes to spend your votes.

Thank you!

  • Comment on Re^4: Do modules know the callers full path?

Replies are listed 'Best First'.
Re^5: Do modules know the callers full path?
by LanX (Saint) on Feb 15, 2023 at 22:19 UTC
    > Of all the things I was trying only abs_path($0) and abs_path((caller)[1]) DWIM.

    Really? Careful!

    They are different if your module is used by another intermediate module and not the root script.

    > It's fun watching you guys hash it out though,

    This is also hard, because you leave room for interpretation.

    Only you can tell us what you exactly want.

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

        > Of all the things I was trying only abs_path($0) and abs_path((caller)[1]) DWIM.

        Really? Careful! They are different if your module is used by another intermediate module and not the root script.

      As I'm testing it now, the module is used by a script. But it will also be used by an intermediate module! Without testing it I'm not sure which will work in both cases, or if each case requires its own solution...