Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^4: File::Random module (McA)

by gautamparimoo (Beadle)
on Apr 02, 2013 at 08:54 UTC ( #1026625=note: print w/replies, xml ) Need Help??

in reply to Re^3: File::Random module (McA)
in thread File::Random module

I saw the module Path::Iterator::Rule. But how am I gonna implement randomness through this module?

One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. -Elbert Hubbard

Replies are listed 'Best First'.
Re^5: File::Random module (McA)
by tobyink (Abbot) on Apr 02, 2013 at 09:32 UTC

    Fairly easily...

    use PIR; my @files = PIR->new->file->all($some_dir); printf "Random file is: %s\n", $files[rand @files];
    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

      Thank you for the snippet (++). Could you prove on Windows?


        @tobyink That was not what i meant by random.. This think can be easily done the same way as u did by find(). Through random I wanted to see the random file as it is ie dont wanna create a array first and then select random files from it. Rather traverse the drive such that i get random files to process while traversing.. Any ideas?

        One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. -Elbert Hubbard
Re^5: File::Random module (McA)
by McA (Priest) on Apr 02, 2013 at 09:18 UTC


    I just wanted to spend some more time to help you with this question, but as I tried to install Path::Iterator::Rule (I'm aware of the module name) on Windows (Strawberry Perl) I got errors from tests. You guess it: Concerning path/drive letter seperator.

    Sorry, I can't help you at the moment even being interested.

    UPDATE: David made an update of the package. Look at Re^5: File::Random module (Path::Iterator::Rule).


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026625]
[Discipulus]: The Count of Moret; The Red Sphinx is a single book appeared with different titles. it is one of the best and alot of understimed Dumas book.
choroba has only read the first two
[Discipulus]: if i can suggest La Reine Margot too is a great book and obviously The Count of Monte Cristo that is a chef-d'œuvre
[Discipulus]: The red sphinx is about Rechilieu, absolutely thrilling
[erix]: thanks, Discipulus - I got them lined up at gutenberg :)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2017-05-24 07:21 GMT
Find Nodes?
    Voting Booth?