On Wed Jan 05 07:10:03 2011, mzealey wrote:
Show quoted text> Hi again,
>
> I know I'm being a bit silly using this for non-testing routines but
> would it be possible to change the scope of $warned_of_unknown_test_lib
> to our so I can change it from outside to disable warnings if I really
> want to?
>
> Mark
It's hard for me to justify this hack for an unknown use case, but I looked into it briefly. If you
really want to use this for non-testing code,
sub _identify_callers_test_package_of_choice {
## This is called at each test in case Test::Differences was used before
## the base testing modules.
## First see if %INC tells us much of interest.
my $has_builder_pm = grep $_ eq "Test/Builder.pm", keys %INC;
my $has_test_pm = grep $_ eq "Test.pm", keys %INC;
return "Test" if $has_test_pm && !$has_builder_pm;
return "Test::Builder" if !$has_test_pm && $has_builder_pm;
if ( $has_test_pm && $has_builder_pm ) {
## TODO: Look in caller's namespace for hints. For now, assume Builder.
## This should only ever be an issue if multiple test suites end
## up in memory at once.
return "Test::Builder";
}
}
As a hack on top of this hack, you should just be able to "use Test::Builder". That adds it to
%INC and makes this problem magically go away. Let me know if that works for you.
Cheers,
Curtis