Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Issue with File::Copy and move

by davido (Cardinal)
on Sep 12, 2020 at 16:26 UTC ( [id://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.


Dave

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-16 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found