kenahoo / Path-Class

Cross-platform path specification manipulation
http://search.cpan.org/dist/Path-Class/
15 stars 28 forks source link

Can't handle errors for copy_to on Unix #54

Open wagnerflo opened 5 years ago

wagnerflo commented 5 years ago

Since on Unix platforms Path::Class::File::copy_to uses system() to run cp handling (or even logging) copy errors is impossible in my daemon: The cp writes it's error messages to a stderr that has been closed long ago...

kenahoo commented 5 years ago

Thanks for the report. My assumption is that the system cp performs better than the Perl emulation in File::Copy::cp, and handles permissions cases better, but I haven't really verified any of that. I agree that it makes error checking more difficult (the caller doesn't know whether it should check $? or $@ or $! or what).

Would using File::Copy::cp work better in your use case, and if so, do you know a performance comparison?

wagnerflo commented 5 years ago

Yes. For now I've replaced copy_to with File::Copy::cp and can handle and log errors like that. I have no idea about performance, though.