[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How do you... solve the pathnameproblem?



>But... we all know that Mac OS and Unix differ in how they use pathnames.
>How do you solve the problem?  How do you write portable code? (or don't
>you try?)
>
>I thought it might be helpful to collect some examples of how different
>people solve the pathname problem.  Do you:
>   Use a function?
>   Define a "$pathseparator" variable?
>   Stick all of your file/directory names into variables?
>   Use a module?
>     which one?
>     something from CPAN? or did you write it?


In my code, I put paths in variables and often also define
a delimiter for paths.  But I also try to keep my pathnames
consistent across platforms -- convenient when you control
the machines that your code runs on, but wouldn't be so
great if I were offering my code for others to use.

But then again many of these problems are cultural.  I don't
think it's too much to ask folks to stick to simple alpha-
numeric file and folder names (permitting also underscores,
dashes and periods).  Having said that I should also confess
that I do have a habit of using "/" when putting dates in my
filenames -- luxuries of a Macintosh.  If I catch myself I'll
switch my slashes to dashes.

-Eric