develooper Front page | perl.perl5.porters | Postings from February 2002

File::Copy::syscopy doesn't preserve OS attrs on UNIX

From:
Stas Bekman
Date:
February 4, 2002 00:19
Subject:
File::Copy::syscopy doesn't preserve OS attrs on UNIX
Message ID:
3C5E43ED.8070603@stason.org
The File::Copy manpage says:

        File::Copy also provides the "syscopy" routine, which
        copies the file specified in the first parameter to the
        file specified in the second parameter, preserving OS-speĀ­
        cific attributes and file structure.  For Unix systems,
        this is equivalent to the simple "copy" routine.

but copy() doesn't preserve OS attributes, therefore on Unix systems 
File::Copy provides no function to copy a file while preserving OS 
attributes.

Two solutions: Either fix the documentation or fix the code:

1. The doc is misleading, suggested patch is:

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

or rephrase the para to say that syscopy() is available only for certain 
platforms.

2. Shouldn't we have a syscopy() that does preserve the OS args on UNIX? 
The fix is of course:

   chmod (stat $from_h)[2], $to_h;

if the $from_h is a not an opened fh already.

p.s. This behavior is observed in at least bleadperl and 5.6.1.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




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