Don't ask to ask, just ask | |
PerlMonks |
Re^2: POSIX::S_ISDIR() with $stat->mode values from Windows vs. Linuxby jakobi (Pilgrim) |
on Oct 06, 2009 at 18:25 UTC ( [id://799552]=note: print w/replies, xml ) | Need Help?? |
Alexander talked enough about symlinks that I want to add this caution on both symlinks and hardlinks to the thread: If you write to existing files other than append-without-backup, and there's the tiniest risk of a user trying to symlink or hardlink that file: explicitely specify how you write out the file. Funny things happen: E.g. sed -i.bak or perl i.bak and that patch on Fedora recently being removed: changing sed's semantics wrt symlinks and surprising everyone.
So at the very least, document how and when you're breaking symlinks or hardlinks on writing. Or not breaking them. Which might be just as bad. cu Footnote: -d _ reuses the previous stat, as Alexander writes, just -d does a new stat using $_. So this an an example of terseness being possibly more costly in both debugging time and runtime :).
In Section
Seekers of Perl Wisdom
|
|