dagolden / Path-Tiny

File path utility
41 stars 58 forks source link

RFE: copy() & move() on existing Path::Tiny file object: return existing object #282

Open djerius opened 1 year ago

djerius commented 1 year ago

copy and move ignore the Path::Tiny-ness of what is passed to them, treating their argument as a string.

If they recognized a Path::Tiny file object and returned it, that would prevent the following foot-gun:

$temp_copy = path('/etc/motd')->copy( Path::Tiny->tempfile );

I don't think it's possible to avoid this one:

$temp_copy = path('/etc/motd')->copy( Path::Tiny->tempdir );