develooper Front page | perl.perl5.porters | Postings from October 2003

Re: new slurp module

Thread Previous | Thread Next
Gisle Aas
October 23, 2003 04:57
Re: new slurp module
Message ID:
Ilya Martynov <> writes:

> I've seen file::slurp reinvented zillion times even if developers knew
> about it (along "it is so simple module and I don't want another
> external dependancy" line of reasoning).  There must be a core module
> for this!  Both thumbs up for including it in core. And, yeah, I'd
> keep old name.

I agree.  I think File::Slurp is a fine name for this but I don't like
the current API.  The function names to read/write whole files need to
be short and sweet, otherwise why bother.  I always reinvent the
reader as a function called cat() myself but I'm not sure I would
recommend that name.

Other issues with such an API:
   - binmode or not by default
   - how to specify IO layers to use
   - how to report errors
   - should it write directly or write to a temp and then rename

The reader is probably much more useful than the writer and it is
simpler to agree on how it should work.  I would consider only having

The current append_file() and overwrite_file() functions seems useless
to me.  If you want this you are probably better off using open and


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About