in reply to Perl module management

Personally, I wouldn't/don't modify the use in-line (and wouldn't recommend it either), instead... In this way, the code doesn't have to change purely because development is underway - perl/the shell will pick up the appropriate module/script.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Perl module management
by andrewtaz (Initiate) on Jul 23, 2009 at 01:14 UTC

    This sounds like a neat idea to me. One remaining question though, how do I instantiate the correct set of libraries?

      I suspect it'll be pretty much as you are already - the major difference being in the actual usage.
      1. Set up your environment as hinted earlier i.e. as follows:
        export PERL5LIB=/opt/scripts/development/lib;/opt/scripts/stable/lib export PATH=/opt/scripts/development/lib;/opt/scripts/stable/lib:$PATH
      2. Check out the stable code into /opt/scripts/stable/lib
      3. Check out development code (into /opt/scripts/development/lib) when and only when you need to fix/enhance code
      4. In main.pl, just use module; as normal - perl will pick up the development version in preference to the stable version (because of the order in which you declared the libraries in PERL5LIB).
      5. If main.pl is to be changed, merely check out the development version - simply entering main.pl on the command line, the shell willpick up the development version.
      6. Once development work is complete and the file checked in, remove the file from the development library.
      Having said that, your way of working is unusual in as much as it is more usual to maintain only one copy of a file within the version control system - you have multiple/dual copies of files knocking about disproportionately increasing the maintenance overhead.

      I'm guessing each file is located within CVS under opt/scripts/development/lib/name.pm or opt/scripts/stable/lib/name.pm ... or maybe even development/lib/name.pm or stable/lib/name.pm.

      Far more usual would be to maintain just one copy - located under either lib/name.pm, name.pm, lib/module/name.pm or module/name.pm (the latter 2 catering for CPAN compatible directory structure) - the target root directory being set as appropriate when checking the file out (and the file being removed from the development area on check-in).

      A user level that continues to overstate my experience :-))