Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: What's your programming style?

by davido (Cardinal)
on Dec 08, 2018 at 12:51 UTC ( #1226965=note: print w/replies, xml ) Need Help??


in reply to What's your programming style?

It's been years since I wrote Perl targeting Windows systems, but I seem to recall that there is no need, when dealing with paths from within Perl code, to differentiate between Windows and Linux flavor path separators. Indeed perlport has this to say:

DOS, OS/2, VMS, VOS, and Windows can work similarly to Unix with / as path separator, or in their own idiosyncratic ways (such as having several root directories and various "unrooted" device files such NIL: and LPT:).

When in doubt it's best to use a module known for its ability to bridge these sorts of gaps. Modules like Path::Tiny, File::Basename, File::Spec (or File::Spec::Functions), and so on. Used with a little care they can take the need for most OS-specific code in your primary codebases, and where they fall short, you should probably modularize your own solutions so that primary business logic is not peppered with OS-specific cruft.

As for programming style, verbosity is not one of the virtues of a programmer. ....although you wouldn't know that by reading one of my wordy posts. ;)


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1226965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2019-06-19 05:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (84 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!