Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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


Comment on Re^4: File::Random module (McA)
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?

      McA

        @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

    Hi,

    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).

    McA

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026625]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2015-07-28 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls