NAME

File::Find::Random -

SYNOPSIS

use File::Find::Random;


my $file = File::Find::Random->find();

my $file = File::Find::Random->find('path/');

my $finder = File::Find::Random->new();
$finder->base_path('/foo/bar');
my $file = $finder->find();

DESCRIPTION

Randomly selects a file from a filesystem.

METHODS

new

Returns a find object.

base_path

Sets or returns the base_path

find

The biggest function, can be called as a class method or a object method. Automagically will set base_path if passed a parameter. Returns a random file.

If it cannot find a file it will throw an exception of type Error::File::Find::Random.

BUGS

If the finder finds a empty directory or a finds itself in a place where it has no permissions to descend further, it will throw an error. This might be seen as a bug and might get fixed.

While it is random which file is selected, there is no mechanism in place to counter the imbalance that occurs if you have varying depth of directories. However our use is on very big filesystem with equally distributed directory structures.

AUTHOR

Arthur Bergman
arthur@fotango.com
http://opensource.fotango.com/

COPYRIGHT

Copyright 2003 Fotango Ltd All Rights Reserved.

This module is released under the same license as Perl itself.