Skrevet av Emne: Perl: How to use modules in a custom directory  (Lest 4275 ganger)

ATC

  • Gjest
Perl: How to use modules in a custom directory
« på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • When trying to "use" modules in a custom directory, perl says it can't find the module in any of the directories in @INC.

    If I try to manually add the directory to @INC, perl seems to ignore it.



    ATC

    • Gjest
    [Solved] Perl: How to use modules in a custom directory
    « Svar #1 på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • Modules are actually "used" by perl when the script is parsed, now while it is running. This means that any changes to @INC at runtime will happen only AFTER perl searches for the modules to use.

    Instead, a "lib" pragma exists for this purpose. To use Custom.pm:
    use lib "/my/module/directory"
    use Custom;