Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Death to $HOME, long live File::HomeDir

by Anonymous Monk
on Nov 17, 2011 at 12:19 UTC ( #938610=perlmeditation: print w/ replies, xml ) Need Help??

Death to $HOME, long live File::HomeDir

If you're thinking of using $HOME, don't, use File::HomeDir

If you need to install templates along side your module, don't install them next to .pm files, use File::ShareDir instead

Why? Portability, re-usability, standardization, upgrade-ability, PAR-packability

Comment on Death to $HOME, long live File::HomeDir
Re: Death to $HOME, long live File::HomeDir
by sundialsvc4 (Abbot) on Nov 17, 2011 at 16:43 UTC

    I certainly learned that lesson when I had to move a program from Unix to Windows ... and to maintain it, for a time, in both environments simultaneously.   I don’t know who wrote the original code, and that is probably a good thing, because I think that I would have a word with him or her...

    Within CPAN, there are idioms that allow you to do various operating-system specific things in a non-OS specific way, just by virtue of using a CPAN module that will install itself appropriately in different environments.   Now, your code is portable.   And, if you peer inside the guts of some of these modules, you find that the solutions that they implement are often much more rugged and thorough than what you would have come up with on your own steam.

Reaped: Re: Death to $HOME, long live File::HomeDir
by NodeReaper (Curate) on Nov 21, 2011 at 13:04 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://938610]
Approved by jettero
Front-paged by jettero
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-07-07 12:23 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (88 votes), past polls