First of all, I think somebody needs to rewrite my question, I know what I am asking, not how I should ask it precisely.
Assume I have some local module LOCAL::Commons
and it has one subroutine called globalTrim
. I am testing that subroutine below, and while LOCAL::Commons
is installed under /usr/local/lib/perl
, the module I am testing below is located in directory /home/me/perl/LOCAL/
. See how I am using use lib ...
to make sure I am not using LOCAL::Commons
located in /usr/local/lib/perl
(I have this directory on my path).
Now, if LOCAL::Commons
is using another local module LOCAL::Cool
(that is, not from cpan), and I have also made some changes to that module, how can I make sure my tests are using the correct modules? That is, I want LOCAL::Commons
to use /home/me/perl/LOCAL/Cool
and not /usr/local/lib/perl/LOCAL/Cool
.
#!/usr/bin/perl
# test_local_commons.pl
# directory: /home/me/perl
use strict;
use warnings;
use Test::More 'no_plan';
use File::Temp qw( tempfile tempdir );
use Cwd qw();
use lib Cwd::abs_path();
# Testing
use LOCAL::Commons qw ( globalTrim );
sub newTest($) {
my $name = shift;
print "---------------------------------------------------\n";
print $name, "\n";
print "---------------------------------------------------\n";
}
sub testTraverse {
is(globalTrim(" - stackoverflow - ), "-stackoverflow-", "Passed" );
}
newTest "testTraverse"; testTraverse ();