On 5/22/06, David Golden <[EMAIL PROTECTED]> wrote:

How portable does this need to be?  My inclination is not to mess with
file permissions in a test suite if you can avoid it.


...

For system interaction tests, I prefer to fake failures rather than try
to manufacture them.


All things being equal, its better to test the real code than stub bits out
to fake a failure.  It brings your tests closer to reality.

Sometimes this isn't possible, but with filesystem tests it usually is.  The
safest thing to do is work inside your t/ directory rather than the system
temp directory which you may or may not have permission to use.  It may not
even exist.  You can still use File::Temp for this, just use the DIR option.

   use File::Temp;

   my $tempdir = tempdir( DIR => "t" );

This will create a temporary directory inside t/ which you own and you're
free to do whatever you want with.

Reply via email to