Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File::AllUtils or similar

1 view
Skip to first unread message

Jonathan Swartz

unread,
Jun 28, 2010, 6:52:28 PM6/28/10
to module-...@perl.org
I'm getting tired of writing chains like

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

David Golden

unread,
Jun 28, 2010, 7:43:39 PM6/28/10
to Jonathan Swartz, module-...@perl.org
On Mon, Jun 28, 2010 at 6:52 PM, Jonathan Swartz <swa...@pobox.com> wrote:
> 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.

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

Paul Bennett

unread,
Jul 4, 2010, 3:14:44 PM7/4/10
to module-...@perl.org
On Mon, 28 Jun 2010 18:52:28 -0400, Jonathan Swartz <swa...@pobox.com>
wrote:

> 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

0 new messages