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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|