How do I use test Perl modules from test Perl scripts?

Posted by DVK on Stack Overflow See other posts from Stack Overflow or by DVK
Published on 2010-03-19T02:14:49Z Indexed on 2010/03/19 2:21 UTC
Read the original article Hit count: 513

Filed under:
|

If my Perl code has a production code location and "test" code location (e.g. production Perl code us in /usr/code/scripts, test Perl code is in /usr/code/test/scripts; production Perl libraries are in /usr/code/lib/perl and test versions of those libraries are in /usr/code/test/lib/perl, is there an easy way for me to achieve such a setup?

The exact requirements are:

  • The code must be THE SAME in production and test location.

    To clarify, to promote any code (library or script) from test to production, the ONLY thing which needs to happen is literally issuing cp command from test to prod location - both the file name AND file contents must remain identical.

  • Test versions of scripts must call other test scripts and test libraries (if exist) or production libraries (if test libraries do not exist)

  • The code paths must be the same between test and production with the exception of base directory (/usr/code/ vs /usr/code/test/)

I will present how we solved the problem as an answer to this question, but I'd like to know if there's a better way.

© Stack Overflow or respective owner

Related posts about perl

Related posts about testing