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 ( [id://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 (Canon) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1026625]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found