Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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

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?
[Discipulus]: 'give man a fish erix it sonds like a push towards omosexuality.. ;=)
[Discipulus]: see Re: from txt file to array erix
[erix]: yeah, I ask for the text (I don't see signatures)
[Discipulus]: dear brother karl has "Furthermore I consider that Donald Trump must be impeached as soon as possible" in his sig
[erix]: ah, thanks Discipulus
[1nickt]: erix perhaps you could kindly point out your technique to roho and everyone will be happy.
[Discipulus]: but i'm also animalist, so i' hirted by 1nickt's sig: The way forward always starts with a mammal test... grin..
[erix]: I might if I did remember. It's probably somewhere in the site docs
[uhClem]: I don't favor that sort of thing around here but the place for our politics is wherever we live.
[uhClem]: And besides, the objection to it was off-topic.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-06-22 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (519 votes). Check out past polls.