http://www.perlmonks.org?node_id=991961

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

Greetings Monks.

I'm writing a test to make sure a new version of a perl module is compatible with an old version. The most obvious way to do that is to run the various functions from both versions and compare the result.

Obviously I can't just 'use' or 'require' the two modules, as they have the same package name and the same subroutine names and so on. The solution, it seems to me, would be to load the first version, then rename it's package somehow.

Something like this:

use Test::More; require 'old_lib/Foo/Bar.pm'; change_package_name('Foo::Bar','Old::Foo::Bar'); require 'lib/Foo/Bar.pm'; ok( Foo::Bar::baz('wibble') eq Old::Foo::Bar::baz('wibble'),'baz is co +mpatible'); ...etc...

Thanks!
--Pileofrogs