Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > File::Copy::copy With File Handles

Reply
Thread Tools

File::Copy::copy With File Handles

 
 
MaggotChild
Guest
Posts: n/a
 
      10-18-2011
The documentation for File::Copy warns against using file handles as
arguments:

Note that passing in files as handles instead of names may lead
to
loss of information on some operating systems; it is
recommended
that you use file names whenever possible.

Does this refer to handles created with the older FileHandle module
(which is used in the module's synopsis), IO::Handle subclasses, or
both?

In either case what's the issue with handles that may lead to data
loss?
 
Reply With Quote
 
 
 
 
MaggotChild
Guest
Posts: n/a
 
      10-19-2011
On Oct 18, 2:39*pm, Ben Morrow <(E-Mail Removed)> wrote:
> Quoth MaggotChild <(E-Mail Removed)>:
>
> > The documentation for File::Copy warns against using file handles as
> > arguments:

>
> > * * * *Note that passing in files as handles instead of names may lead
> > to loss of information


> On non-Unix systems (more specifically, on Win32 and I believe VMS)
> File::Copy calls the system file-copy routine (CopyFile on Win32) if you
> pass it filenames. This will preserve things like ACLs, extended
> attributes, NTFS streams, and so on.


I had ignored the obvious and interpreted "loss of information" to
mean loss of the file's data, not necessarily metadata. Which lead to
me to believe that for some subtle reason File::Copy couldn't be used
reliably copy data streams. Thanks for the clarification.


 
Reply With Quote
 
 
 
 
Ilya Zakharevich
Guest
Posts: n/a
 
      10-22-2011
On 2011-10-19, MaggotChild <(E-Mail Removed)> wrote:
>> On non-Unix systems (more specifically, on Win32 and I believe VMS)
>> File::Copy calls the system file-copy routine (CopyFile on Win32) if you
>> pass it filenames. This will preserve things like ACLs, extended
>> attributes, NTFS streams, and so on.

>
> I had ignored the obvious and interpreted "loss of information" to
> mean loss of the file's data, not necessarily metadata. Which lead to
> me to believe that for some subtle reason File::Copy couldn't be used
> reliably copy data streams. Thanks for the clarification.


The division into data/metadata is a tricky stuff. For example, "the
metadata" may contain the character encoding of a text file. If lost,
it would render the "data" completely useless.

Or the "thumbnail lower-resolution image" of a photo file. On
filesystems with arbitrary metadata allowed, the natural place for the
thumbnail image is in the metadata. On legacy filesystems, the viewer
program would be forced to either recalculate it each time, or put it
into the EXIF sections of the file (thus changing "THE DATA") or keep
it somewhere where it does not survive renaming of the file.

Yours,
Ilya
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about file handles and windows handles @ Windows Operating Systems eino Python 1 05-08-2007 09:14 PM
Open file handles? Thomas Bartkus Python 3 08-10-2006 02:22 AM
Image file handles left open by aspnet_wp when serving up pages Mike Kiefer ASP .Net 1 09-21-2004 08:30 PM
Integrating FILE * and int file handles Denis Remezov C++ 12 05-11-2004 08:20 PM
Open file handles D. Alvarado Java 1 07-21-2003 03:16 PM



Advertisments