| June 27, 2006 | Two or Three Things I Learned ... | Back Next |
Use File::Temp when testing requires creation of directories or files.
{
use_ok( 'File::Temp', qw| tempdir |);
my $tdir = tempdir( CLEANUP => 1);
ok(chdir $tdir, 'changed to temp directory for testing');
...
ok(chdir $cwd, 'changed back to original directory');
}
| Home Last TOC |
|
© 2006 James E Keenan |
|
Back Next |