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

前端 未结 2 408
日久生厌
日久生厌 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:33

    A cleaner way to do it imo is :

    use lib "/path/" ;  
    

    there are other interesting and good ways to do it that can be found here:

    http://www.slideshare.net/pfig/cpan-training-presentation/

    Also, re: CGI scripts, you CAN define PERL5LIB paths for your CGI Env, it just depends on your webhost.

    Some Webhosts permit specific control of env variables for the CGI Enviroment, and you have to just set them, others may have a "permit" list that allows variables visible at start time appear in local scope.

    May help to read up on how to do this on your specific HTTP server.

    There is one more option, if setting ENV is not to your taste: local::lib

    Which searches some predefined paths automatically.

提交回复
热议问题