[Israel.pm] File permissions and File::Copy

Offer Kaye oferk at oren.co.il
Mon May 31 07:15:01 PDT 2004


Hi mongers,
I'm trying to use File::Copy's "copy" function to copy an executable file
(permissions = 755 = "rwxr--r--"). OS is Linux, BTW.
The problem is that File::Copy does not preserve the executable permissions
of the file. I think the problem is that the function opens the target using
Perl's "open" function. The relevant code line (I think) from the
File/Copy.pm source:
   open($to_h,"> $to\0") or goto fail_open2;
(this is line number 130 in File::Copy version 2.05).
What can I do to make File::Copy preserve the file permissions when copying?
Is this a bug or a feature? :-)

And no, I don't want to use the shell's copy...
Thanks in advance,
----------------------------------
Offer Kaye




More information about the Perl mailing list