Test-Regression-0.07000755000000000000 012167537275 15043 5ustar00unknownunknown000000000000Test-Regression-0.07/Build.PL000444000000000000 124412165026564 16465 0ustar00unknownunknown000000000000use Module::Build; Module::Build->new( module_name => 'Test::Regression', license => 'perl', requires => { 'Test::More' => 0, 'Test::Differences' => 0, 'Text::Diff' => 0, 'Algorithm::Diff' => 0, 'FileHandle' => 0 }, build_requires => { 'Test::MockObject' => 0, 'DirHandle' => 0, 'File::Spec' => 0 }, meta_merge => { resources=> { repository => 'http://github.com/periapt/test-regression/tree', }, keywords => ['Test','Regression'], }, create_makefile_pl => 'traditional', dist_author => 'Nicholas Bamber ', )->create_build_script; Test-Regression-0.07/Changes000444000000000000 130112167537260 16460 0ustar00unknownunknown000000000000Revision history for Test-Regression 0.01 12-09-2009 First version 0.02 13-09-2009 Headline documentation error. Fixed t/changes.t and t/manifest.t 0.03 20-09-2009 Added more dependencies and license 0.04 28-09-2009 Various documentation changes 0.05 21-01-2010 Tested for zero-length output in generating file (rt53893). Added tests for 'open' and 'print' functions failing. Migrated to OS independent access to file system in test scripts 0.06 19-11-2010 Switched to binmode for better portability (rt60638). Thank to Christian Walde. Also switched to utf8 format for code. 0.07 11-07-2013 Marked more tests as author tests to avoid bogus fails. Test-Regression-0.07/Makefile.PL000444000000000000 120712167537274 17151 0ustar00unknownunknown000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.4005 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Test::Regression', 'VERSION_FROM' => 'lib/Test/Regression.pm', 'PREREQ_PM' => { 'Algorithm::Diff' => 0, 'DirHandle' => 0, 'File::Spec' => 0, 'FileHandle' => 0, 'Test::Differences' => 0, 'Test::MockObject' => 0, 'Test::More' => 0, 'Text::Diff' => 0 }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {} ) ; Test-Regression-0.07/MANIFEST000444000000000000 43712167537260 16307 0ustar00unknownunknown000000000000Build.PL Changes lib/Test/Regression.pm Makefile.PL MANIFEST MANIFEST.SKIP META.yml README t/00-load.t t/boilerplate.t t/changes.t t/lib/OutputDir.pm t/manifest.t t/open.t t/perlcritic.t t/perlcriticrc t/pod-coverage.t t/pod.t t/podspell.t t/prereq.t t/print.t t/regression.t META.json Test-Regression-0.07/MANIFEST.SKIP000444000000000000 012167537260 16776 0ustar00unknownunknown000000000000Test-Regression-0.07/META.json000444000000000000 275112167537275 16626 0ustar00unknownunknown000000000000{ "abstract" : "Test library that can be run in two modes; one to generate outputs and a second to compare against them", "author" : [ "Nicholas Bamber " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4005, CPAN::Meta::Converter version 2.120921", "keywords" : [ "Test", "Regression" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-Regression", "prereqs" : { "build" : { "requires" : { "DirHandle" : "0", "File::Spec" : "0", "Test::MockObject" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0.40" } }, "runtime" : { "requires" : { "Algorithm::Diff" : "0", "FileHandle" : "0", "Test::Differences" : "0", "Test::More" : "0", "Text::Diff" : "0" } } }, "provides" : { "Test::Regression" : { "file" : "lib/Test/Regression.pm", "version" : "0.07" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/periapt/test-regression/tree" } }, "version" : "0.07" } Test-Regression-0.07/META.yml000444000000000000 161112167537275 16450 0ustar00unknownunknown000000000000--- abstract: Test library that can be run in two modes; one to generate outputs and a second to compare against them author: - Nicholas Bamber build_requires: DirHandle: '0' File::Spec: '0' Test::MockObject: '0' configure_requires: Module::Build: '0.40' dynamic_config: 1 generated_by: Module::Build version 0.4005, CPAN::Meta::Converter version 2.120921 keywords: - Test - Regression license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-Regression provides: Test::Regression: file: lib/Test/Regression.pm version: '0.07' requires: Algorithm::Diff: '0' FileHandle: '0' Test::Differences: '0' Test::More: '0' Text::Diff: '0' resources: license: http://dev.perl.org/licenses/ repository: http://github.com/periapt/test-regression/tree version: '0.07' Test-Regression-0.07/README000444000000000000 206312165026564 16051 0ustar00unknownunknown000000000000Test-Regression Test library that can be run in two modes: once to generate outputs and secondly to compare against them INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Test::Regression You can also look for information at: RT, CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Regression AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Test-Regression CPAN Ratings http://cpanratings.perl.org/d/Test-Regression Search CPAN http://search.cpan.org/dist/Test-Regression/ COPYRIGHT AND LICENCE Copyright (C) 2009 Nicholas Bamber This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. Test-Regression-0.07/lib000755000000000000 012167537275 15611 5ustar00unknownunknown000000000000Test-Regression-0.07/lib/Test000755000000000000 012167537275 16530 5ustar00unknownunknown000000000000Test-Regression-0.07/lib/Test/Regression.pm000444000000000000 1140512167537260 21356 0ustar00unknownunknown000000000000package Test::Regression; use warnings; use strict; use FileHandle; use utf8; =head1 NAME Test::Regression - Test library that can be run in two modes; one to generate outputs and a second to compare against them =head1 VERSION Version 0.07 =cut our $VERSION = '0.07'; =head1 SYNOPSIS use Test::Regression; ok_regression(sub {return "hello world"}, "t/out/hello_world.txt"); =head1 DESCRIPTION Using the various Test:: modules you can compare the output of a function against what you expect. However if the output is complex and changes from version to version, maintenance of the expected output could be costly. This module allows one to use the test code to generate the expected output, so that if the differences with model output are expected, one can easily refresh the model output. =head1 EXPORT ok_regression =cut use Test::Builder::Module; use Test::Differences; use base qw(Test::Builder::Module); our @EXPORT = qw(ok_regression); my $CLASS = __PACKAGE__; =head1 FUNCTIONS =head2 ok_regression This function requires two arguments: a CODE ref and a file path. The CODE ref is expected to return a SCALAR string which can be compared against previous runs. If the TEST_REGRESSION_GEN is set to a true value, then the CODE ref is run and the output written to the file. Otherwise the output of the file is compared against the contents of the file. There is a third optional argument which is the test name. =cut sub ok_regression { my $code_ref = shift; my $file = shift; my $test_name = shift; my $output = eval { &$code_ref(); }; my $tb = $CLASS->builder; if ($@) { $tb->diag($@); return $tb->ok( 0, $test_name ); } # generate the output files if required if ( $ENV{TEST_REGRESSION_GEN} ) { my $fh = FileHandle->new; $fh->open(">$file") || return $tb->ok( 0, "$test_name: cannot open $file" ); $fh->binmode; if ( length $output ) { $fh->print($output) || return $tb->ok( 0, "actual write failed: $file" ); } return $tb->ok( 1, $test_name ); } # compare the files return $tb->ok( 0, "$test_name: cannot read $file" ) unless -r $file; my $fh = FileHandle->new; $fh->open("<$file") || return $tb->ok( 0, "$test_name: cannot open $file" ); $fh->binmode; my $content = join '', (<$fh>); eq_or_diff( $output, $content, $test_name ); return $output eq $file; } =head1 ENVIRONMENT VARIABLES =head2 TEST_REGRESSION_GEN If the TEST_REGRESSION_GEN environment file is unset or false in a perl sense, then the named output files must exist and be readable and the test will run normally comparing the outputs of the CODE refs against the contents of those files. If the environment variable is true in a perl sense, then model output files will be overwritten with the output of the CODE ref. =head1 AUTHOR Nicholas Bamber, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head2 testing of STDERR The testing of stderr from this module is not as thorough as I would like. L allows turning off of stderr checking but not matching by regular expression. Handcrafted efforts currently fall foul of L. Still it is I believe adequately tested in terms of coverage. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Test::Regression You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS =over =item Some documentation improvements have been suggested by toolic (http://perlmonks.org/?node_id=622051). =item Thanks to Filip GraliƄski for pointing out I need to test against output of zero length and providing a patch. =item Thanks to Christian Walde for pestering me about newline Windows compatibility issues and for providing a patch. =back =head1 COPYRIGHT & LICENSE Copyright 2009-10 Nicholas Bamber. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Test::Regression Test-Regression-0.07/t000755000000000000 012167537275 15306 5ustar00unknownunknown000000000000Test-Regression-0.07/t/00-load.t000444000000000000 24112165026564 16731 0ustar00unknownunknown000000000000#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'Test::Regression' ); } diag( "Testing Test::Regression $Test::Regression::VERSION, Perl $], $^X" ); Test-Regression-0.07/t/boilerplate.t000444000000000000 255512167537267 20142 0ustar00unknownunknown000000000000#!perl -T use strict; use warnings; use Test::More; if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } sub not_in_file_ok { my ($filename, %regex) = @_; open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } { not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); module_boilerplate_ok('lib/Test/Regression.pm'); } Test-Regression-0.07/t/changes.t000444000000000000 55312165026564 17213 0ustar00unknownunknown000000000000use strict; use warnings; use Test::More; if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } eval { require Test::CheckChanges; }; if ( $@ ) { my $msg = 'Test::CheckChanges required to check Changes'; plan( skip_all => $msg ); } Test::CheckChanges::ok_changes(); Test-Regression-0.07/t/manifest.t000444000000000000 72312165026564 17410 0ustar00unknownunknown000000000000use strict; use warnings; use Test::More; if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } eval { require Test::CheckManifest; }; if ( $@ ) { my $msg = 'Test::CheckManifest required to check manifest'; plan( skip_all => $msg ); } Test::CheckManifest::ok_manifest({filter=>[qr/\/\.git/,qr/\.bak$/,qr/\.old$/,qr/t\/dbfile$/,qr/\.tar\.gz$/,qr/\/t\/output\/\w{2}$/]}); Test-Regression-0.07/t/open.t000444000000000000 330612165026564 16563 0ustar00unknownunknown000000000000#!perl use strict; use warnings; our $mock; use Test::Builder::Tester tests => 3; use Test::More; BEGIN { eval "use Test::MockObject::Extends"; unless( $@ ) { use FileHandle; $mock= Test::MockObject::Extends->new(FileHandle->new); $mock->fake_new( 'FileHandle' ); $mock->set_false( 'open' ); } use_ok( 'FileHandle' ); use_ok( 'Test::Regression' ); } use Test::Regression; srand(42); use lib qw(t/lib); use OutputDir; sub faithful_function { my $r = ""; for(my $i = 0; $i < 10; $i++) { $r .= "$i\n"; } return $r; } sub unfaithful_function { my $r = ""; for(my $i = 0; $i < 10; $i++) { $r .= rand()."\n"; } return $r; } sub empty_string_function { return ''; } test_out("not ok 1 - f1 gen: cannot open t/output/f1"); test_out("not ok 2 - f1 check: cannot read t/output/f1"); test_out("not ok 3 - f2 gen: cannot open t/output/f2"); test_out("not ok 4 - f2 check: cannot read t/output/f2"); test_out("not ok 5 - f4 gen: cannot open t/output/f4"); test_out("not ok 6 - f4 check: cannot read t/output/f4"); test_diag(" Failed test 'f2 check'"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&faithful_function, "t/output/f1", "f1 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&faithful_function, "t/output/f1", "f1 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&unfaithful_function, "t/output/f2", "f2 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&unfaithful_function, "t/output/f2", "f2 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&empty_string_function, "t/output/f4", "f4 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&empty_string_function, "t/output/f4", "f4 check"); test_test(name=>"blah", skip_err=>1); Test-Regression-0.07/t/perlcritic.t000444000000000000 103212165026564 17754 0ustar00unknownunknown000000000000use strict; use warnings; use File::Spec; use Test::More; use English qw(-no_match_vars); if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } eval { require Test::Perl::Critic; }; if ( $EVAL_ERROR ) { my $msg = 'Test::Perl::Critic required to criticise code'; plan( skip_all => $msg ); } my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' ); #use Test::Perl::Critic; Test::Perl::Critic->import( -profile => $rcfile ); all_critic_ok(); Test-Regression-0.07/t/perlcriticrc000444000000000000 125512167533543 20050 0ustar00unknownunknown000000000000severity = 1 exclude = Subroutines::ProhibitExplicitReturnUndef Subroutines::RequireArgUnpacking ClassHierarchies::ProhibitAutoloading RegularExpressions Miscellanea::RequireRcsKeywords Documentation::RequirePodAtEnd ControlStructures::ProhibitUnlessBlocks ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions ControlStructures::ProhibitPostfixControls Documentation::RequirePodSections References::ProhibitDoubleSigils Variables::ProhibitPunctuationVars ValuesAndExpressions::ProhibitInterpolationOfLiterals Subroutines::ProhibitManyArgs ValuesAndExpressions::ProhibitNoisyQuotes ValuesAndExpressions::ProhibitEmptyQuotes Documentation::RequirePodLinksIncludeText Test-Regression-0.07/t/pod-coverage.t000444000000000000 126412167533543 20200 0ustar00unknownunknown000000000000use strict; use warnings; use Test::More; if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); Test-Regression-0.07/t/pod.t000444000000000000 56512167533543 16372 0ustar00unknownunknown000000000000#!perl -T use strict; use warnings; use Test::More; if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); Test-Regression-0.07/t/podspell.t000444000000000000 130112167533543 17437 0ustar00unknownunknown000000000000use strict; use warnings; use English qw(-no_match_vars); use Test::More; if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } eval { require Test::Spelling; }; if ( $EVAL_ERROR ) { my $msg = 'Test::Spelling required to criticise code'; plan( skip_all => $msg ); } Test::Spelling::add_stopwords(qw(CPAN Bamber Walde AnnoCPAN RT internalId lang param HTML URLs href sitemap SQL bladger javascript loopName URL globalvars pageId pageid sitemaps XML changefreq en lastmod notfound pagelookup runmode runmodes url utf namespace upto stderr yml toolic Filip Grali)); Test::Spelling::all_pod_files_spelling_ok(); Test-Regression-0.07/t/prereq.t000444000000000000 100012165026564 17105 0ustar00unknownunknown000000000000use strict; use warnings; use Test::More; if ( not $ENV{TEST_PREREQ} ) { my $msg = 'Author test. Set $ENV{TEST_PREREQ} to a true value to run.'; plan( skip_all => $msg ); } eval { require Test::Prereq::Build; }; if ( $@) { my $msg = 'Test::Prereq required to criticise code'; plan( skip_all => $msg ); } Test::Prereq::Build::prereq_ok(undef, 'prereq', ['Test::CheckChanges', 'Test::CheckManifest', 'Test::Spelling', 'Test::Prereq', 'Test::Prereq::Build', 'Test::Perl::Critic','OutputDir']); Test-Regression-0.07/t/print.t000444000000000000 312212165026564 16752 0ustar00unknownunknown000000000000#!perl use strict; use warnings; our $mock; use Test::Builder::Tester tests => 2; use Test::More; BEGIN { use FileHandle; eval "use Test::MockObject::Extends"; unless( $@ ) { $mock = FileHandle->new; $mock= Test::MockObject::Extends->new($mock); $mock->set_false( 'print' ); $mock->fake_new('FileHandle'); } use_ok( 'Test::Regression' ); } use Test::Regression; srand(42); use lib qw(t/lib); use OutputDir; sub faithful_function { my $r = ""; for(my $i = 0; $i < 10; $i++) { $r .= "$i\n"; } return $r; } sub unfaithful_function { my $r = ""; for(my $i = 0; $i < 10; $i++) { $r .= rand()."\n"; } return $r; } sub empty_string_function { return ''; } test_out("not ok 1 - actual write failed: t/output/f1"); test_out("not ok 2 - f1 check"); test_out("not ok 3 - actual write failed: t/output/f2"); test_out("not ok 4 - f2 check"); test_out("ok 5 - f4 gen"); test_out("ok 6 - f4 check"); test_diag(" Failed test 'f2 check'"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&faithful_function, "t/output/f1", "f1 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&faithful_function, "t/output/f1", "f1 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&unfaithful_function, "t/output/f2", "f2 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&unfaithful_function, "t/output/f2", "f2 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&empty_string_function, "t/output/f4", "f4 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&empty_string_function, "t/output/f4", "f4 check"); test_test(name=>"blah", skip_err=>1); Test-Regression-0.07/t/regression.t000444000000000000 304212165026564 17777 0ustar00unknownunknown000000000000#!perl use strict; use warnings; use Test::Builder::Tester tests => 1; use Test::More; use Test::Regression; use lib qw(t/lib); srand(42); use OutputDir; sub faithful_function { my $r = ""; for(my $i = 0; $i < 10; $i++) { $r .= "$i\n"; } return $r; } sub unfaithful_function { my $r = ""; for(my $i = 0; $i < 10; $i++) { $r .= rand()."\n"; } return $r; } sub fatal_function { die "How am I doing?"; } sub empty_string_function { return ''; } test_out("ok 1 - f1 gen"); test_out("ok 2 - f1 check"); test_out("ok 3 - f2 gen"); test_out("not ok 4 - f2 check"); test_out("not ok 5 - f3 gen"); test_out("not ok 6 - f3 check"); test_out("ok 7 - f4 gen"); test_out("ok 8 - f4 check"); test_diag(" Failed test 'f2 check'"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&faithful_function, "t/output/f1", "f1 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&faithful_function, "t/output/f1", "f1 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&unfaithful_function, "t/output/f2", "f2 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&unfaithful_function, "t/output/f2", "f2 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&fatal_function, "t/output/f3", "f3 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&fatal_function, "t/output/f3", "f3 check"); $ENV{TEST_REGRESSION_GEN} = 1; ok_regression(\&empty_string_function, "t/output/f4", "f4 gen"); delete $ENV{TEST_REGRESSION_GEN}; ok_regression(\&empty_string_function, "t/output/f4", "f4 check"); test_test(name=>"blah", skip_err=>1); Test-Regression-0.07/t/lib000755000000000000 012167537275 16054 5ustar00unknownunknown000000000000Test-Regression-0.07/t/lib/OutputDir.pm000444000000000000 54512165026564 20462 0ustar00unknownunknown000000000000package OutputDir; use strict; use warnings; use Carp; use File::Spec; use DirHandle; use FileHandle; sub BEGIN { my $dirname = File::Spec->catfile("t", "output"); mkdir $dirname || croak "error: $!"; my $dir = DirHandle->new($dirname); if (defined $dir) { while (defined($_ = $dir->read)) { unlink File::Spec->catfile($dirname, $_); } } } 1