develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Recommended file-copying method

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
July 8, 2013 03:36
Subject:
Re: Recommended file-copying method
Message ID:
CA+vYcVwgTeJ+gYPfxV3wEnzy1YWhxyLGANL_9hkQ=o8ZcfwQ5Q@mail.gmail.com
On Sun, Jul 7, 2013 at 8:29 PM, David Golden <xdg@xdg.me> wrote:

> * uses sysread instead of read, so if your handle wasn't raw for some
> reason, layers are ignored (except for the utf8 flag, which winds up
> lax instead of possibly strict) so you're shooting your foot with a
> machine gun

Anything that claims to be a file copy but is at all concerned about
the encoding of the contents of the file is not actually a file copy.
Trying to maintain otherwise is a major layer violation and is
shooting yourself in the head with a bazooka.  And while there is
probably no Perl primitive that is an especially good basis for an
efficient file copy, sysread is likely the best one there is.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About