Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Darwin and File::HomeDir

by wrinkles (Pilgrim)
on May 20, 2011 at 21:01 UTC ( [id://905974]=perlquestion: print w/replies, xml ) Need Help??

wrinkles has asked for the wisdom of the Perl Monks concerning the following question:

A number of modules, including local::lib, cpan and padre, use File::HomeDir to set things like the "data directory". That happens to be set to "Application Support" in File::HomeDir::Darwin:
sub my_data { my $class = shift; $class->_my_home('Library/Application Support'); }

The space in "Application Support" causes problems with various modules. What is the best way to deal with that problem? I realize that's a wide-open question, but I'm having difficulty seeing the trees for the forest on this.

Do I submit a bug request on a per-module basis? Is there alternate manual installations to work around? Do I remove File:HomeDir? Do I just hack the Darwin module and substitute my own directory? Will I need to reinstall local::lib? Or what? I just want things to work.

Any advice appreciated, TIA

Replies are listed 'Best First'.
Re: Darwin and File::HomeDir
by John M. Dlugosz (Monsignor) on May 20, 2011 at 23:50 UTC
    I've always had that problem in Windows, where the Perl tool-chain is hostile to spaces and the standard locations contain spaces. Perl is usually not installed under “Program Files” but directly under the root, like it was still 1986.

    I've worked around that by using the short-name alias for the intended directory. You might be able to so something similar, creating a symbolic link to the correct directory, and having the Data Directory return that instead.

    By all means, report every broken use you find. But I don't think the Makefile and CPAN tools will ever work with them.

      Perl is usually not installed under “Program Files” but directly under the root, like it was still 1986.

      Only with Strawberry Perl (which is why I'll never use it). ActivePerl lets you choose, and has done so since I started using it (5.6).

      I've worked around that by using the short-name alias for the intended directory

      That would require making a link in the root directory at least as recently as WinXP, and I consider that unacceptable.

        I was referring to ActivePerl. If you override the suggested location and restore it to the normal location for programs, lots of things break later. Using the short-name alias instead works most of the time.
Re: Darwin and File::HomeDir
by Anonymous Monk on May 20, 2011 at 21:09 UTC
    Do I submit a bug request on a per-module basis?

    Yes. space in filename makes no difference to perl or the operating system, only broken applications.

Re: Darwin and File::HomeDir
by ikegami (Patriarch) on May 20, 2011 at 21:33 UTC
    You could suggest a documentation update to File::HomeDir that highlights the fact that it's common for path with spaces to be returned.
      You could suggest a documentation update to File::HomeDir that highlights the fact that it's common for path with spaces to be returned.

      Seems backwards to me. cpan has for a long time been broken with regards to spaces in paths, and it is a known issue. I doubt a patch to File::HomeDir documentation is going to have an impact.

      Hmm, after thinking about it, such a warning actually sounds quite stupid , along the lines of warning: an integer can be a negative number :/

        warning: an integer can be a negative number :/

        I actually suggested "warning: the return value can be negative", and I have indeed done that in situations where people tended to assume only positive numbers could be returned.

        I doubt a patch to File::HomeDir documentation is going to have an impact.

        I agree, but there's not much else that can be done. The only other alternative is to convince OS vendors not to use spaces in the paths to user home dirs.

        Seems backwards to me.

        Trying to impose limits on the user to kowtow to broken some modules sounds backwards to me.

        Trying to convince OS vendors to change their practices to address bugs in modules sounds backwards to me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://905974]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-03-28 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found