Actually, unless you mean, "It acts differently depending on the OS", I think you could be in for a surprise. For example, look at the difference between cp on Linux and on FreeBSD. | [reply] |
Wow, something documented as taking only two parameters will not behave correctly if given more than two parameters. I am astounded.
(I'm however sympathetic on the charge about permissions problems; the system's cp will try and preserve permissions rather than subjecting you to the whims of your umask.)
| [reply] |
Except of course that File::Copy::copy will take three arguments, and that's documented as well.
But since File::Copy::copy is usually promoted as "Perl's replacement for cp", people will expect it to behave as cp. And not study the documentation carefully.
You for instance either didn't study the documentation carefully, or if you did, forgot it. Because you wrongly assumed File::Copy::copy only takes two arguments. Now your mistake isn't as costly as forgetting the meaning of the third parameter. But if you can forget File::Copy::copy having a third parameter, you might as well forget that File::Copy::copy acts the same as cp when given two arguments, but very, very different when given three.
use File::Copy;
my @files1 = qw [foo];
my @files2 = qw [bar baz];
my $dir = "/tmp";
copy @files1, $dir; # No problem.
copy @files2, $dir; # File::Copy will warn, but erase 'baz' anyw
+ay.
Now had you used your systems 'cp', it would have copied all three files into /tmp.
And had you used an all numeric $dir in the above code fragment, File::Copy::copy would have overwritten baz without so much as a warning. | [reply] [d/l] |
Funny, my copy of File::Copy's documentation plainly states:
The "copy" function takes two parameters: a file to copy from and a file to copy to.
It then quite clearly goes on to note the optional third parameter which is in no manner, shape, or form a path name of any kind. The post I was responding to seemed to imply that they expected copy to work like cp with multiple arguments and a trailing directory name, which it doesn't (as the documentation explains; "I copy from the first argument to the second argument").
I'm sorry that there exist people dense enough to blindly presume things without reading the documentation, but it's quite obvious what copy allows for arguments.
| [reply] [d/l] [select] |