Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Issue with File::Copy and move

by davido (Cardinal)
on Sep 12, 2020 at 16:26 UTC ( #11121672=note: print w/replies, xml ) Need Help??

in reply to Issue with File::Copy and move

Programming bugs typically occur for very precise reasons. Therefore, it is important for code samples to be precise, and to actually duplicate the behavior that is being seen. Your code sample will not compile because you didn't quote your file paths. Because of this mistake, we must be left to wonder what else, in your code example, fails to demonstrate the actual bug you are seeing. It's often difficult to decipher what mistake you're making if the code sample you provide isn't useful, or has errors unrelated to what you're asking about.

I can say that this works as intended:

$ touch foo # Create a file. $ rm -rf foobar # Assure that the foobar directory doesn't exist. $ perl -MFile::Copy=move -E 'move("foo", "foobar/foo") or die $!' # T +est a move into a directory that doesn't exist. # No such file or directory at -e line 1. ls foo # Assure the original file still exists. # foo

The file still exists after the failed move.


Replies are listed 'Best First'.
Re^2: Issue with File::Copy and move
by Anonymous Monk on Sep 14, 2020 at 14:53 UTC
    Yes, and this can also lead to an "XY error" where you think that you're seeing one behavior but, because you don't realize that you made a possibly-unrelated mistake, are completely misled about what is actually going wrong. BIG time-waster.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11121672]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2021-01-20 13:25 GMT
Find Nodes?
    Voting Booth?