in reply to Re^4: how to move multiple files
in thread how to move multiple files
I'm curious why you used a sub given that it's a script, not a module, and it only gets called once
Bod, further to kcott's excellent reply (especially "a subroutine abstracts functionality and promotes reuseability; it has nothing to do with script vs. module" ++) a few more thoughts on the tricky topic of how best to test end user scripts.
My preferred approach is to abstract the work the script does into CPAN-like modules and unit test each module using Test::More and the prove command. Accordingly, I strive to keep my script mainlines as short as is practicable. There are many examples of this approach on the CPAN; the perltidy command, for example, is effectively a one-liner:
exit Perl::Tidy::perltidy( argv => $arg_string );
Though I'm not a fan, an alternative approach, concocted by brian_d_foy (who has made 93 fewer posts than you ;-), is modulinos (how a script becomes a module).
|
|---|