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

I am looking for a strategy for developing a package on a machine that has an earlier version installed. I might want to using existing calling code but have it call the package in development rather than the installed version. Any calling code that uses other packages is going to want to check my existing library path. So far I have used a convoluted system of library precedence, but I am finding it a bit unwieldy. What do other people do?

Replies are listed 'Best First'.
Re: Package development strategy
by jpl (Monk) on Apr 18, 2011 at 10:52 UTC

    I use a two-level strategy. I have a Production hierarchy with a PERL5LIB directory for local modules, and a bin directory for local executables (also used to pick and choose from various standard directories that a command might appear in). A Development directory has parallel directories containing only exceptions... the production directories also appear in the development PERL5LIB and search PATH, but following the development versions. So all the standard production stuff will work in the development hierarchy, but I can try out whatever combination of modules and commands I want in the development side. When I'm happy, I move the stuff from development to production.

    updated I perhaps should add that I use a wrapper command on my "shebang" line.

    #!/home/project/dev/wrapbin/perl -w

    perl there is just a symlink to a generic a.out that sets up my search PATH and PERL5LIB and assorted other project-specific environment variables, then execs the basename of the command by which it was invoked, perl, in this case, but make and your favorite shell are other useful commands to wrap, since they can profit from the environment variables set by the wrapper. The command to be executed usually appears in the bin directory the wrapper puts at the start of the PATH. This keeps all the environment manipulation out of the script, so the move from development to production involves nothing more than changing the shebang line. You can even try out a completely new version of perl in the development world, by linking to that version in the development-specific bin directory. But if you invoke any perl scripts that are still (only) in the production world, you would have to do so as perl script.pl rather than script.pl, to avoid the production-side wrapper. Truth be told, I usually rely on the good folks who give us perl to do all the hard work of ensuring backward compatibility. If I want to try out a new perl, I replace the link in the production bin to address the new perl. I can always change it back if something unsavory happens. The scripts themselves need not change at all, which makes the overhead of the wrapper worthwhile.

Re: Package development strategy
by Anonymous Monk on Apr 18, 2011 at 05:38 UTC
    There is only one option, manage your %PATH%, manage your @INC
Re: Package development strategy
by anonymized user 468275 (Curate) on Apr 18, 2011 at 11:56 UTC
    There is no point in developing code for the same project that requires varying minimum versions. So I tend to pick the highest required version by whatever modules are used and "require" that Perl version. However, the entire suite of code in question should be mature enough in its dev. cycle to reasonably fix its total module list before such a decision should be taken.

    One world, one people