1#! perl -T
2
3# Taint tests for module File::Path
4
5use strict;
6
7use Test::More tests => 6;
8
9BEGIN {
10    use_ok('File::Path', qw(rmtree mkpath make_path remove_tree));
11    use_ok('File::Spec::Functions');
12}
13
14# find a place to work
15my $tmp_base = catdir(
16    curdir(),
17    sprintf( 'taint-%x-%x-%x', time, $$, rand(99999) ),
18);
19
20# invent some names
21my @dir = (
22    catdir($tmp_base, qw(a b)),
23    catdir($tmp_base, qw(a c)),
24    catdir($tmp_base, qw(z b)),
25    catdir($tmp_base, qw(z c)),
26);
27
28# create them
29my @created = make_path(@dir);
30is(scalar(@created), 7, "created list of directories");
31
32my $count = rmtree($tmp_base, {error => \(my $err), result => \my $res});
33is( $count, 7, 'rmtree under taint' );
34is( scalar(@$err), 0, 'no errors' );
35is( scalar(@$res), 7, 'seven items' );
36