anjiro has asked for the wisdom of the Perl Monks concerning the following question:

I have a somewhat complicated copy process I want to do. I need to recursively copy one directory to another, doing some processing during the copy. File::Repl is exactly what I want, except that the part that I want isn't actually implemented (the Process functionality). What would be perfect would be something that looks like:
use File::IdealCopy; my $cp = new IdealCopy(recursive => 1, rename_callback => \&rename, post_copy_callback => \&post); IdealCopy("/mnt/source", "/data/dest"); sub rename { return lc; } sub post { open FP1, $_[0] or die; open FP2, ">$_[0].new" or die; while(<FP>) { chomp; print FP2, $_ + 1, $/; } close FP1; close FP2; }
Of course, there's no File::IdealCopy. Any ideas?

Replies are listed 'Best First'.
Re: Recursive copy with processing
by dragonchild (Archbishop) on May 01, 2006 at 19:08 UTC
    Grab a copy of File::Repl, hack in the features you want, use said features. If you want, feel free to either provide the features back to the author and/or release it as your own.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?