sub compare_output { my %param = @_; my $check_file = $param{check_file}; my $output2 = ${$param{output_ref}}; my $output1 = read_file($check_file, 1); _print_diff($output1, $output2); _ok(($output1 eq $output2) or defined $ENV{TEST_FIX}); if(defined $ENV{TEST_FIX} and $output1 ne $output2) { # special mode for writting test report output files write_file($check_file, $output2); } } # ok compatible with Test and Test::Builder sub _ok { # if Test is already loaded use its ok if(Test->can('ok')) { @_ = $_[0]; goto \&Test::ok; } else { require Test::Builder; local $Test::Builder::Level = $Test::Builder::Level + 1; Test::Builder->new->ok(@_); } }