How can my Perl script find its module in the same directory?

后端 未结 9 1060
执念已碎
执念已碎 2020-12-23 19:26

I recently wrote a new Perl script to kill processes based on either process name / user name and extended it using Classes so that I could reuse the process code in other p

9条回答
  •  无人及你
    2020-12-23 19:46

    You can make perl look in any directory by using the -I flag. Here, -I stands for @INC which is the array of paths in which perl looks for modules. Using -I adds the given path to the @INC array for this execution.

    eg:

    perl -I lib bin/script.pl
    

    where lib contains the modules I want to use.

    I know that this works for perl 5. I am not at sure about other versions.

提交回复
热议问题