Qiang has asked for the wisdom of the Perl Monks concerning the following question:

we install modules in a central location and add the path to PERL5LIB for mod_perl. the modules are commonly used by other small/mid size perl apps. once in a while, a new module is required or nice to have and i am debating about whether to put them under the project lib directory or in the commonly used module directory.. my head is telling me to put it into commonly used dir even if it is not currently.

how do you maintain modules in this situation?

Replies are listed 'Best First'.
Re: manage commonly used modules
by pc88mxer (Vicar) on Feb 26, 2008 at 20:26 UTC
    For mission critical apps, I would suggest every application have its own module directory. That way when you deploy/upgrade your app you know exactly what modules (and versions) are being used. Often the modules an app is using will be stored in your source code repository along with the app's source.

    Disk space is cheap - time spent tracking down software config issues isn't.

      that will work only if this is the only perl app i am running in the server or it is running under non mod_perl environment (that's what we had before under plain cgi: modules stores in each app lib directory).
Re: manage commonly used modules
by CountZero (Bishop) on Feb 26, 2008 at 20:27 UTC
    If the modules are for general use and not only for one project, I would put them in a generally accessible location and keep the project related ones in the project directory.

    It would also be useful to give priority to the project lib directories over the general directory so you can use newer or experimental versions of some modules just in a project and have everyone else use the more stable versions.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      It would also be useful to give priority to the project lib directories over the general directory so you can use newer or experimental versions of some modules just in a project and have everyone else use the more stable versions.
      i don't think that is possible with mod_perl. it will always use the same module that has already been loaded and multiple version of a module won't work in mod_perl.
        Apache2::Reload can be used to reload a newer version of a module without restarting the server (but you pay in lower performance of the server and your modules get unshared over the parent/children).

        For the multiple-versions-of-the-same-module problem I do not know a solution.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James