Ask any experienced Perl programmer which core module has the most abysmal interface, and they'd probably say File::Find. (...)

I bet you all have heard/read similar sentences before. The problem is that I simply do not understand them. Why does the concept of passing a function as an argument to another function look so strange and hard to grok to all those people? Why do they consider an interface as simple as "find all files in THESE directories and do THIS with them" abysmal? How is

find( sub {print $_,"\n"}, '.');
harder to understand than
while ($_ = readdir DIR) { print $_,"\n"; }
. (I know these two do not mean the same thing.)

Why do so many people have such huge problems to understand map {code} @aray yet foreach (@array) { code } looks natural to them? :-(

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

P.S.: Quite some time ago I asked on a VB forum how do I make a reference to a function in VB. They could not even understand why would anyone want to do such thing :-(


In reply to File::Find considered hard? by Jenda

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.