Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Alias (5735)

Alias
  (email not shown publicly)
http://ali.as/

Journal of Alias (5735)

Sunday May 23, 2010
06:58 PM

Add safety to test scripts for File::HomeDir applications

[ #40363 ]

I always feel a bit depressed when I go on a long geek/coding trip and don't come back having released something.

Since my work is slowly drifting more towards architecture and strategy where I do less coding than I used to, writing something this trip has been tough.

Fortunately, with a few hours to kill at Seattle airport I've managed to knock out File::HomeDir::Test, which is a way to test applications that use File::HomeDir safely and without spewing files into places that the installed application will discover later.

The pattern in your application is just the following...

use File::HomeDir::Test;
use File::HomeDir;

The first line creates a temporary directory that lives for the duration of the test scripts, ads hijacking flags for the base File::HomeDir load, and hijacks $ENV{HOME} to point to the temp directory.

After you have loaded File::HomeDir::Test (in a way that results in ->import being called) File::HomeDir should just work as normal.

It has been released as File::HomeDir 0.91. This release also sees the landing of the FreeDesktop.org driver in a production release for the first time, so please report any problems you may see on Linux.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hi, this API is lacking. You're modifying state and expecting it to get used elsewhere and maybe it or maybe it won't or maybe something else now will fall over because things are possibly "strange."

    Further, there's little reason for a user to think that loading something that looks like a class isn't going to be the normal sort of idempotent action we normally expect "Yes please, this I require that class X be loaded".

    Quite sure this use of use() ought to look unlike a regular class-loading use of use(). O