Kenneth Ölwing <[EMAIL PROTECTED]> wrote:
> Hmm, sorry if I steal your thunder :-), but have you looked at
File::Find?

Hi Ken1,

Yes, indeed, I have used File::Find in the past, but ran into some
limitations.
That's why I was quite excited to hear MJD give a talk on Higher Order Perl
at.
the NA YAPC a couple years back. I began experimenting with his simple but
powerful recursive subroutine code, and now have quite a bit of scripts and
apps (on Unix and Linux) that do a number of tricks.

I ran across this bit in one of Randall Schwartz's articles. He talks about
at least one of those File::Find limitations (which may have been fixed by
now, I haven't looked lately.)

Randall Schwartz -- http://www.stonehenge.com/merlyn/LinuxMag/col30.html:

The traditional File::Find module included with Perl is nice. I use it
frequently. However, it's got this interesting feature, or shall we call
it, ``limitation'': it wants to be in control until it has found everything
of interest.


Now that's perfectly fine for most applications, but occasionally, I've
wanted to turn a hierarchical search ``inside out''. That is, I'd set up
the search, including the start directories and the ``wanted'' criteria,
and then call some function repeatedly to get the ``next'' item of
interest. This is similar to how I can call the find program externally:


  open FIND, "find /home -atime +60 -print|";
  while (<FIND>) {
    chomp;
    printf "%s aged %d days using %d blocks\n",
      $_, -A $_, -s $_ / 1024;
  }


Recently, I saw Mark-Jason Dominus, Perl hacker extraordinaire, give a talk
on using streams and iterators, and he pulled out an example that was very
close to what I wanted. He was showing off a subroutine that acted as a
factory, generating subroutines that when repeatedly invoked, provided the
``next'' file to be found in sequence. (It's one of his examples from his
forthcoming book, some of which may already be found at
http://perl.plover.com/book/.) He then went on to show how to put this
inside a filter to throw away the files that did not meet the necessary
criteria.

best,

 /dennis

------------------------------------------------
Dennis Daupert, PhD
Senior Systems Development Professional -- CSC Account
CSC

GOS | o: 1.317.298.9499 | [EMAIL PROTECTED] | www.csc.com

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose.

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to