how rename() actually works on read-only files just went over my head.
rename doesn't modify any files; it modifies a directory or two. As long as you have write access to the source and destination directories, you can rename the file.
$ touch foo
$ chmod 0 foo
$ ls -li
total 0
11314128152 ---------- 1 ikegami pg1404028 0 Dec 11 10:11 foo
$ perl -e'rename("foo", "bar") or die $!'
$ ls -li
total 0
11314128152 ---------- 1 ikegami pg1404028 0 Dec 11 10:11 bar
$ chmod a-w .
$ perl -e'rename("bar", "baz") or die $!'
Permission denied at -e line 1.
$ ls -li
total 0
11314128152 ---------- 1 ikegami pg1404028 0 Dec 11 10:11 bar
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.