http://www.perlmonks.org?node_id=370805


in reply to When should a wheel be reinvented

In general...

If it does what you want but can't modify it, you wrap it.
If it's a blackbox, you rewrite it if you have the resources. Blackboxes are dangerous.
If you have the source, you fix it unless it takes too long.

-s

Bart: God, Schmod. I want my monkey-man.

Replies are listed 'Best First'.
Re^2: When should a wheel be reinvented
by tilly (Archbishop) on Jul 01, 2004 at 02:16 UTC
    You cannot generally wrap a callback interface with a looping interface unless you have continuations, co-routines, or some other similar construct. Perl does not. (Well, there is a module that adds it, but I'm not sure what issues it has. Certainly it isn't a built-in feature.)

    Whether it is good for a language to have continuations is another debate, and there are top-notch people who'll argue both sides of that choice.

    Regardless, Perl 6 will have continuations.

      Here, here. See this node for some further discussion (which, in fact, also happens to mention File::Find and it's callback-based interface).
      ------------ :Wq Not an editor command: Wq
        If you're motivated, I'd suggest trying to find some of Dominus' comments on File::Find. His opinion seems to resemble yours - File::Find works well except that the API can be very inconvenient. IIRC his book (which should be coming out really soon...) on higher-order Perl implements an iterator-based equivalent to File::Find.