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

[perl #120619] Clarification for File::Copy documentation

Thread Previous
From:
Tony Cook via RT
Date:
December 16, 2013 23:38
Subject:
[perl #120619] Clarification for File::Copy documentation
Message ID:
rt-4.0.18-22747-1387237087-429.120619-15-0@perl.org
On Sat Nov 23 14:11:05 2013, rrt wrote:
> File::Copy's documentation says about syscopy: "For Unix systems, this is
> equivalent to the simple "copy" routine, which doesn't preserve OS-specific
> attributes."
> 
> Does this mean that syscopy is like copy, and not like cp, where, according
> to the same documentation, "as of version 2.15, <cp> will preserve the
> source file's permission bits like the shell utility cp(1) would do"? That
> would not seem very logical.
> 
> Also, the phrase "doesn't preserve OS-specific attributes" is confusing
> when talking about a particular OS: when reading the page, I wondered if it
> referred to file-system-specific attributes on UNIX. Maybe it's better just
> to leave it out.
> 
> Assuming that sanity prevails under the hood, and syscopy is equivalent to
> cp, I suggest rewriting this as:
> 
> "For Unix systems, this is equivalent to the simple "cp" routine."
> 
> If for some reason syscopy on Unix works the same as "copy", then instead:
> 
> "For Unix systems, this is equivalent to the simple "copy" routine, and
> doesn't preserve attributes."
> 
> (Checked against latest version at http://perldoc.perl.org/File/Copy.html)

For Unix systems (everything but OS/2, Win32, VMS) syscopy is an alias for copy:

# &syscopy is an XSUB under OS/2
unless (defined &syscopy) {
    if ($^O eq 'VMS') {
	*syscopy = \&rmscopy;
    } elsif ($^O eq 'MSWin32' && defined &DynaLoader::boot_DynaLoader) {
	# Win32::CopyFile() fill only work if we can load Win32.xs
	*syscopy = sub {
	    return 0 unless @_ == 2;
	    return Win32::CopyFile(@_, 1);
	};
    } else {
	$Syscopy_is_copy = 1;
	*syscopy = \&copy;
    }
}


I don't think your edit of the sentence from:

For Unix systems, this is equivalent to the simple C<copy> routine, which doesn't preserve OS-specific attributes.

to:

For Unix systems, this is equivalent to the simple C<copy> routine, and
doesn't preserve attributes.

adds much, since copy() does preserve OS independent attributes - the content of the file.

Tony


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=120619

Thread Previous


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