Cross Reference: Recurs.pm
xref
: /
osnet-11
/
usr
/
src
/
cmd
/
perl
/
5.8.4
/
distrib
/
t
/
lib
/
MakeMaker
/
Test
/
Setup
/
Recurs.pm
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
package
MakeMaker
::
Test
::
Setup
::
Recurs
;
1
N/A
1
N/A
@
ISA
=
qw
(
Exporter
);
1
N/A
require
Exporter
;
1
N/A
@
EXPORT
=
qw
(
setup_recurs
teardown_recurs
);
1
N/A
1
N/A
use
strict
;
1
N/A
use
File
::
Path
;
1
N/A
use
File
::
Basename
;
1
N/A
1
N/A
my
%
Files
= (
1
N/A
'
Recurs
/
Makefile.PL
'
=> <<
'END'
,
1
N/A
use
ExtUtils
::
MakeMaker
;
1
N/A
1
N/A
WriteMakefile
(
1
N/A
NAME
=>
'Recurs'
,
1
N/A
VERSION
=>
1.00
,
1
N/A
);
1
N/A
END
1
N/A
1
N/A
'
Recurs
/
prj2
/
Makefile.PL
'
=> <<
'END'
,
1
N/A
use
ExtUtils
::
MakeMaker
;
1
N/A
1
N/A
WriteMakefile
(
1
N/A
NAME
=>
'Recurs::prj2'
,
1
N/A
VERSION
=>
1.00
,
1
N/A
);
1
N/A
END
1
N/A
);
1
N/A
1
N/A
sub
setup_recurs
{
1
N/A
while
(
my
($
file
, $
text
) =
each
%
Files
) {
1
N/A
# Convert to a relative, native file path.
1
N/A
$
file
=
File
::
Spec
->
catfile
(
File
::
Spec
->
curdir
,
split
m{\/}, $
file
);
1
N/A
1
N/A
my
$
dir
=
dirname
($
file
);
1
N/A
mkpath
$
dir
;
1
N/A
open
(
FILE
,
">$file"
) ||
die
"Can't create $file: $!"
;
1
N/A
print
FILE
$
text
;
1
N/A
close
FILE
;
1
N/A
}
1
N/A
1
N/A
return
1
;
1
N/A
}
1
N/A
1
N/A
sub
teardown_recurs
{
1
N/A
foreach
my
$
file
(
keys
%
Files
) {
1
N/A
my
$
dir
=
dirname
($
file
);
1
N/A
if
( -e $
dir
) {
1
N/A
rmtree
($
dir
) ||
return
;
1
N/A
}
1
N/A
}
1
N/A
return
1
;
1
N/A
}