The following module was proposed for inclusion in the Module List:
modid: File::Random DSLIP: iupfp description: Randomly selection of a file userid: BIGJ (Janek Schleicher) chapterid: 10 (File_Names_Systems_Locking) communities: similar: Tie::Pick Tie::Select Data::Random rationale: In CGI scripts I often want to show the content of randomly choosen file. I'm too lazy to write always something like my @files = (<*.*>); my $rand_file = $files[rand @files]; or opendir DIR, "/foo/bar/" or " ... "; my @files = grep /\.txt$/, (readdir DIR); closedir DIR my $rand_file = $files[rand @files]; Especially, I'm too lazy to do it with recursive directory structures. More important, the main idea is hidden, because all I wanted is something like: use File::Random; my $rand_file = random_file(); # or my $rand_file = random_file(-dir => '/foo/bar', -recursive => 1, # or -r => 1 -check => qr/.../ # or -check => sub {-M < 7}); I'm also often more interested in the content of the randomly selected file, than in the file itselfs. So I'd like to have a function like my @lines = content_of_random_file(); For laziness, I also want to add a simple method my $rand_line = random_line("fname"); (like in the Perl Cookbook). I think, this module will be usefull and I couldn't find such one in CPAN. From a linguistic view Random::File would be a better name, but I don't want to create a new Top Level Domain quite only for such a little module. Also File::Random express very good, what the module stand for. enteredby: BIGJ (Janek Schleicher) enteredon: Tue Jun 18 09:00:44 2002 GMT The resulting entry would be: File:: ::Random iupfp Randomly selection of a file BIGJ Thanks for registering, The Pause Team PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=71200000_c3cd46f2c9b85b4b&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=71200000_c3cd46f2c9b85b4b&SUBMIT_pause99_add_mod_insertit=1