A few weeks ago, someone filed a patch on p5p to allow a new positional parameter to File::Path::rmtree() that would delete everything, but retain the root directory. Which is quite a desirable feature.

Michael G Schwern shot the implementation down, saying (what we all know) that positional parameters suck.

Quick, what would:

    rmtree( ['foo', 'bar', 'rat'], 0, undef, 1 );

do? As it turns out, at the same time I was playing around with the code, seeing if a modern interface (use a hashref as a way of communicating arbitrary control parameters) would work, and retain backwards compatibility. So now the above could be written as:

    rmtree( {verbose => 0, keep_root => 1}, 'foo', 'bar', 'rat' );

And I wound up as co-maintainer of the module. I've added a slew of tests to improve the code coverage and restored 5.005 compatibility (it wasn't hard). It also allows errors to be trapped without having to resort to eval.

The rendered POD is here

  http://www.landgren.net/perl/File-Path.html

and the code, should you care, is here:

  http://svnweb.mongueurs.net/File-Path/view/trunk/Path.pm?lang=en

Comments, criticisms and suggestions welcome.

Thanks,
David

Reply via email to