|Perl Monk, Perl Meditation|
File system nomenclature. Death to path!by wfsp (Abbot)
|on Aug 10, 2008 at 12:51 UTC||Need Help??|
Roots, dirs and files.
A config file might have
A base class could have helper methods/assessors for each of the “roots”
A dir, is a xxx_root, and possibly one or more dir names. A file is a dir with a file name on the end.
Anything that needs to be in an html page is $href and $src etc.
What’s wrong with path? Take a selection of core modules:
I find it confusing to keep on top of what a path is in the different contexts. Throw base and suffix into the mix and I’m rereading the docs again for the umpteenth time. File::Spec’s abs2rel talks about $base and $path. And where did those trees come from? And what do you do with a suffix list?
I would use these modules more if I didn’t get into such a tangle. I invariably have helper methods with names that better fit the conventions I’ve outlined e.g. mkdir.
While far from perfect everything has been a lot smoother since banning path.
A plague on paths!
How do monks manage to avoid such confusion?
update: fixed the join syntax