XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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. In reply to Re: A DWIM too far?
by graff
|
|