in reply to Re: How to build system calls using '=>'
in thread How to build system calls using '=>'
..or any passers by who are hunting for a way to make a path of directories they would be better following blue_cowdawg's advice in Re: "mkdir -p" equivalent? and using mkpath in File::PathI always wonder how useful statements like "it's better to use X instead of Y" are if they don't say why X is better.
I'll bite. I say using the systems 'mkdir' is better than 'mkpath' because the arguments of 'mkpath' are hard to remember (without looking in the docs, what's the second argument of mkpath? How do I tell mkpath which mode I need? How do I create multiple directories in one go?). On top of that, 'mkpath' has a different name than 'mkdir'.
Sure, if you work on a system that doesn't have 'mkdir', you're better off to use File::Path. But then, programming in such an environment is like writing a novel without using the letter 'e'.
If they have a reason they can't use File::Path (even though it's a core module these days) they would be better using the built-in mkdir than shelling out to a system one.And then you present a 17 line piece of code, which has a OS dependency as well, doesn't have an option to set a mode, and is verbose without an option to turn it off.
I strongly prefer to shell out using one line, have the ability to set the mode, and which, by default, is silent.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to build system calls using '=>'
by serf (Chaplain) on Dec 14, 2005 at 15:45 UTC | |
by Perl Mouse (Chaplain) on Dec 14, 2005 at 16:40 UTC | |
by Anonymous Monk on Apr 17, 2009 at 16:34 UTC |