Skip Menu |

This queue is for tickets about the Test-Database CPAN distribution.

Report information
The Basics
Id: 93678
Status: resolved
Priority: 0/
Queue: Test-Database

People
Owner: Nobody in particular
Requestors: TIMB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.112



Subject: Use File::HomeDir's my_home() instead of my_data() to find config file
From dbi-dev mailing list: ---snip--- Show quoted text
> The docs for Test::Database tell me to write ~/.test-database, which I > did, but running tumbler complains about a missing init file at > /home/merijn/.local/share/.test-database
I've never been a fan of File::HomeDir, which Test::Database uses. I added that log message saying what path it was reading in order to work out what the heck it was doing. For me, on a mac, it's using /Users/timbo/Library/Application Support/.test-database' :( I see Test::Database is using the my_data() method which the File::HomeDir docs describe as "data that supports an application but *isn't normally editing* by the user directory should go into my_data." (Emphasis mine.) So use of my_data() is unfortunate. Using my_home() would be more natural for more users. ---snip--- I suggest using my_home() to locate the config file (with a fallback to trying my_data() for backcompat if a file isn't found). That'll avoid the docs either lying on many systems, or having to be updated to match and describe all the places that my_data() might refer to on various systems.
On Sun Mar 09 09:25:57 2014, TIMB wrote: Show quoted text
> From dbi-dev mailing list: > ---snip---
> > The docs for Test::Database tell me to write ~/.test-database, which > > I > > did, but running tumbler complains about a missing init file at > > /home/merijn/.local/share/.test-database
> > I've never been a fan of File::HomeDir, which Test::Database uses.
My main reason for using it was to delegate the complexity of finding the configuration file on every system to a module that would do that consistently. Show quoted text
> I suggest using my_home() to locate the config file (with a fallback > to trying my_data() for backcompat if a file isn't found).
Either that, or getting rid of File::HomeDir entirely. However, then we need to define precisely the expected location(s) of the configuration file. Should there be a global file, in addition to the user's one? -- BooK
Show quoted text
> > I suggest using my_home() to locate the config file (with a fallback > > to trying my_data() for backcompat if a file isn't found).
> > Either that, or getting rid of File::HomeDir entirely. > > However, then we need to define precisely the expected location(s) of the > configuration file.
Switching to my_home() seems reasonable since you're already using File::HomeDir. That way you gets the benefits of File::HomeDir without the 'surprise' of where my_data() is. Show quoted text
> Should there be a global file, in addition to the user's one?
I don't think there's much of a use-case for that yet. It would add complications like people wanting to override or delete global settings. I'd suggest keeping just the one till there's a clear need. Perhaps a compromise where would be to allow an env var to override the location. That way a site could setup a common config file and an env var pointing to it. Tim.