Oh yeah... This is on a par with unlink() being the equivalent of unix
rm -f (i.e. "don't ask questions, just delete the file(s)!") -- and when you combine this with an all-too-common misunderstanding about unix file permissions, you really see how unix gets its reputation as being "not for the feeble-minded or faint-hearted".
The misunderstanding involves setting individual file permissions to "read-only", and thinking that this protects the file from being deleted. It doesn't. The file is protected from having its contents altered by being opened for write access, and that's it.
Now, if the directory containing the file is also set for "read-only" access, then the file is safe, but so long as there is write access on the directory, the file can be deleted (or another file can be renamed to displace/obliterate it).
The default behavior of unix "rm" involves always asking for interactive confirmation before deleting a file that is set for read-only access, but "rm -f" is always available to bypass that safeguard (e.g. when running in a script or makefile), and this is what Perl's "unlink()" does.
I'm not saying it's good or bad for it to be this way. Just like a chainsaw is not intrinsically good or bad... It simply requires care and respect.
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.