Once upon a time in a land far far away, there was a perl monk named Lindex.

This perl monk had an idea one day to write a file system "Web Interface". Ah but there was a problem, the big bad old directory that the "file system web interface" would be managing had a whopping 93,440 files in it, and that if he wrote this perl script to load the contents of said directory into an array, that the script would have a huge memory foot print.

So Lindex decided to have his "web interface" page through the files in increments of 10 or 20. But there was a problem, Lindex didn't have a clue as to how to seek through a directory properly so that he could skip through the contents of the directory allowing him to page through the files. After much tribulation Lindex consulted the Great Tome of Perl Magick to hopefully get help from his fellow perl monks.

To Be Continued

The breakdown...
basicly I just don't know how to set a position on a directory filehandle so that it skips x amount of directory listing. Where I have:

use IO::Dir; my($dir)=IO::Dir->new('/imageproc/files/ips/fullsize/') || die; my($c,$f)=0; while($f=$dir->read() and $c<=9) { print "$c $f\n"; $c++; }

for listing a limited amount of files from a directory if I do a $dir->seek(POS) what should my POS be?


Brought to you by that crazy but lovable guy... lindex

In reply to A story of a Perl Monk and Problem by lindex

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.