How do I use a Perl module from a relative location?

前端 未结 8 2070
予麋鹿
予麋鹿 2020-12-23 16:41

I have a dir called foo, and in that I have lib and bin. The scripts in bin need stuff in lib. I do someth

相关标签:
8条回答
  • 2020-12-23 17:27

    The standard FindBin module does what you want.

    use FindBin;
    use lib "$FindBin::Bin/../lib";
    

    perldoc FindBin for more.

    0 讨论(0)
  • 2020-12-23 17:28
    use lib './';
    

    has been working for me with Perl v5.14.2 on a linux box to include files in the same directory as my script.

    Perhaps it would work for you to move your lib and bin directories under your script's working directory and try to reference them using

    use lib './bin/';
    
    0 讨论(0)
提交回复
热议问题