use Cwd qw(realpath);
use File::Basename;
use File::Path;
use File::Slurp;
use File::Spec::Functions;
use File::Temp;
whenever I write a script that deals with files. Especially since my
cycle is "run script, insert missing use line, run script, insert
missing use line, repeat...". :)
Is there something like a File::AllUtils that uses and exports a bunch
of standard file modules, for some definition of standard? If not,
would it be reasonable for me to release one?
I know about Path::Class, which is an interesting approach, but when I
use it the stringification trips up just often enough to annoy me. I
guess I either prefer or am used to the traditional Perl non-OO
functions for file manipulation.
Thanks
Jon
I have the same annoyance with Path::Class, but use it anyway and just
stringify religiously. You might also see File::Fu, which does
something similar.
If you want to export all the functions from a set of modules, you can
easily whip that up using the ToolSet module. Here is a module that
exports the same list you gave in your email:
# My/Tools.pm
package My::Tools;
use base 'ToolSet';
ToolSet->export(
'Cwd' => 'realpath', # get a specific function
'File::Basename => undef, # get the defaults
'File::Path => undef,
'File::Slurp => undef,
'File::Spec::Functions => undef,
'File::Temp' => undef,
);
1;
You can then just "use My::Tools" and you'll get all the usual stuff
you use. Hope that helps for a quick fix.
-- David
> Is there something like a File::AllUtils that uses and exports a bunch
> of standard file modules, for some definition of standard? If not, would
> it be reasonable for me to release one?
Have you looked at IO::All?
IMHO it's the best module of any kind ever, bar none.
--
Paul