1#!perl -T 2 3use strict; 4use warnings; 5 6use Test::Requires { 7 'Test::Taint' => '0', 8}; 9 10use Test::More 0.88; 11use Test::Fatal 0.006; 12 13taint_checking_ok(); 14 15{ 16 package T; 17 18 use strict; 19 use warnings; 20 21 use lib 't/lib'; 22 23 use Module::Implementation; 24 my $loader = Module::Implementation::build_loader_sub( 25 implementations => [ 'Impl1', 'Impl2' ], 26 symbols => ['return_42'], 27 ); 28 29 ::taint( $ENV{T_IMPLEMENTATION} = 'Impl2' ); 30 31 ::tainted_ok( $ENV{T_IMPLEMENTATION}, '$ENV{T_IMPLEMENTATION} is tainted' ); 32 33 ::is( 34 ::exception{ $loader->() }, 35 undef, 36 'no exception when implementation is specified in env var under taint mode' 37 ); 38} 39 40{ 41 is( 42 Module::Implementation::implementation_for('T'), 43 'Impl2', 44 'T::_implementation returns implementation set in ENV' 45 ); 46} 47 48done_testing(); 49