How can I set Perl's inclusion path for modules for a CGI script?

前端 未结 2 380
日久生厌
日久生厌 2021-01-18 01:00

I’ve got several Perl modules installed on my hosting machine in ~/perl, how do I add them to Perl module path? Setting PERL5LIB or unshift

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 01:21

    PERL5LIB works just fine for CGI scripts. You just have to set the variable in the right place, such as the server configuration. Which webserver are you using? For Apache, I use the SetEnv directive from mod_env.

    @INC is portable. The paths you put in there may not be the same on every machine, but you shouldn't have a problem the with variable itself.

    Have you read the FAQ entries in perlfaq8:

    • How do I add the directory my program lives in to the module/library search path?
    • How do I add a directory to my include path (@INC) at runtime?

提交回复
热议问题