Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # NOTE: Derived from blib/lib/Inline.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Inline; | |
5 | ||
6 | #line 1200 "blib/lib/Inline.pm (autosplit into blib/lib/auto/Inline/_rmtree.al)" | |
7 | sub _rmtree { | |
8 | my($roots) = @_; | |
9 | $roots = [$roots] unless ref $roots; | |
10 | my($root); | |
11 | foreach $root (@{$roots}) { | |
12 | if ( -d $root ) { | |
13 | my(@names,@paths); | |
14 | if (opendir MYDIR, $root) { | |
15 | @names = readdir MYDIR; | |
16 | closedir MYDIR; | |
17 | } | |
18 | else { | |
19 | croak M21_opendir_failed($root); | |
20 | } | |
21 | ||
22 | my $dot = File::Spec->curdir(); | |
23 | my $dotdot = File::Spec->updir(); | |
24 | foreach my $name (@names) { | |
25 | next if $name eq $dot or $name eq $dotdot; | |
26 | my $maybefile = File::Spec->catfile($root,$name); | |
27 | push(@paths,$maybefile),next if $maybefile and -f $maybefile; | |
28 | push(@paths,File::Spec->catdir($root,$name)); | |
29 | } | |
30 | ||
31 | _rmtree(\@paths); | |
32 | ($root) = $root =~ /(.*)/ if UNTAINT; | |
33 | rmdir($root) or croak M54_rmdir_failed($root); | |
34 | } | |
35 | else { | |
36 | ($root) = $root =~ /(.*)/ if UNTAINT; | |
37 | unlink($root) or croak M55_unlink_failed($root); | |
38 | } | |
39 | } | |
40 | } | |
41 | ||
42 | # end of Inline::_rmtree | |
43 | 1; |