Why do you want to avoid POSIX? I know it's in the standard distribution and I'm sure loading it will not be significant at all but ... if it's not *really* needed, well, it's just one less module to load :)
| [reply] |
Well, not that you probably care but I certainly consider that a form of premature optimization. If you are sure that POSIX will cause you issues then I could understand it, absent such evidence its just bad practice. For one, the code you write is less likely to be correct than the code in POSIX, for two if you use a nontrivial selection of modules the likely that POSIX gets loaded anyway is pretty high. So you increase code bloat, probably reduce your run times (I admit I havent benchmarked), increase your chance for error, all for a gain that may not even occur at all. Doesnt sound like good practice to me.
| [reply] |
Hello,
Well, I do care, since this is a question that arises a lot at work, that is: module load times. From previous discussions i gathered that modules take almost zero time to load, especially compared to system calls (that was the origin of the argument, it led to the use of Archive::Tar and others ) .
if you use a nontrivial selection of modules the likely that POSIX gets loaded anyway is pretty high That's a good point, but the fact is that I mainly do system administration and installing more module "just for me" is forbidden. So i only use standard distribution modules, on my current project at least. (granted, these could also, maybe, load posix ! ) probably reduce your run times (I admit I havent benchmarked), System load is the most important point for me, as in everything system. I believe POSIX has quite a lot of things in it, and i'm ready to had a few more lines in trade of the mere possibility that i gain something on that aspect. Maybe i could use POSIX qw(strftime) , but i do not know how this stands in load time difference compared to the whole use posix . Do you know ? Now if i really needed POSIX for something, i would use it. But only to format a date string ? Is it not using posix only for this that would make the code as a whole bloated ? . Anyway, I note the points you make on good practice since it's a very important subject where i certainly need more advice Cheers, ZlR.
| [reply] |