my $results; my $test_data = [qw{foo bar baz}]; { no strict 'refs'; local $^W; # suppres redefined warnings my $arrayref_called = 0; local *{'DBI::fetchrow_arrayref'} = sub {$arraref_called++; $test_data }; $results = some_func($some_arg); is($arrayref_called, 1, '... and fetchrow_arrayref should be called only once'); } ok($results, '... and some_func succeeded'); is_deeply($results, $test_data, '... and it should return the correct data'); #### my @rand = qw/ 0.78195951257749 0.625570958105044 0.884315045123127 0.137177303290578 0.0650888668725038 /; use ex::override rand => sub {unshift @rand => pop @rand; $rand[0]}; print rand, $/ for 1 .. 5;