in reply to Duplicating the 'cp' command's '-u' switch

Also, just how "wrong" is it to use the 'system' command.
IMO, there's nothing wrong with the system command. I prefer using system cp => $file1, $file2 over using File::Copy::copy as well, as the first will do what it is supposed to do, and the latter will be a surprise when it comes to permission bits. Furthermore, cp can take options, more than 2 arguments, directories as arguments, etc, none of which is supported by File::Copy::copy.

People who claim File::Copy::copy is the way to do cp in Perl clearly don't know cp!

As for portability, I think that the majority of the Perl programs are written to operate in a specific environment, where portability isn't an issue at all. Besides, the GNU implementation of cp supports -u, which means you're ok for (allmost?) Unix and most Windows flavours.

Abigail

  • Comment on Re: Duplicating the 'cp' command's '-u' switch