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

Hello

I recently switched from StrawberryPerl 5.24.1 to StrawberryPerl 5.28.0 I am a bit confused by the behavior of the module File::HomeDir on Windows 10.

Calling $data = File::HomeDir->my_data; gives me with 5.24 the right location C:\Users\USER\AppData\Local, with 5.28 C:\Strawberry\data. In both cases I have the latest File::HomeDir (File-HomeDir-1.004). How can this be?

Replies are listed 'Best First'.
Re: File::HomeDir strange behavior Perl 5.28
by haj (Vicar) on Nov 01, 2018 at 10:05 UTC

    I can't confirm that behaviour with my own installation of Strawberry Perl 5.28 which returns C:\Users\USER\AppData\Local as expected. But your result has been the behaviour of the Portable edition with both Perl 5.24 and Perl 5.28 - so maybe you unfortunately caught a portable one to c:\Strawberry? The file README.txt in that directory could provide more information.

      Thank you. Yes, I checked and my 5.28 is a portable edition (berrybrew ).

      Does this mean that berrybrew is a bat choice as it uses the portable versions?

        When trying with Strawberry (portable),
        perl -MFile::HomeDir -e "print $File::HomeDir::IMPLEMENTED_BY;"
        gives me Portable::HomeDir

        If I remove/rename said module (...\perl\vendor\lib\Portable\HomeDir.pm), I get the expected File::HomeDir::Windows.

        It might make sense for berrybrew to do this locally.

        (Update: crossposted to https://github.com/stevieb9/berrybrew/issues/121)

Re: File::HomeDir strange behavior Perl 5.28
by stevieb (Canon) on May 30, 2019 at 19:12 UTC

    A new berrybrew feature, to allow user to use either the Portable or Windows version of File::HomeDir has been implemented in the 1.24 branch, and will become available for production use after its release (a couple weeks from now).

    Currently, it's a global config file bool directive ("windows_homedir" : "false"), and the default is to use the portable version. Setting that directive to "true" will essentially revert back to the Windows functionality.

    berrybrew install $version will pick up on the directive on each run. If the var is toggled between Perl instance installs, each perl will act accordingly. It's a non-reversible action, so to get the default functionality restored, berrybrew remove that instance, change the config directive, and berrybrew install it again.

    I don't really like the idea of having a separate command flag just for this, so I may add in the ability to send an env var as the flag, but I'm not certain yet.