Ticket #737 (reopened defect)
File::HomeDIr->my_documents can be empty list
| Reported by: | danboo | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | External dependency | Version: | 0.49 |
| Keywords: | Cc: | adamk |
Description
When running:
sudo cpan -t Padre
On Mac OSX:
File::HomeDir?->my_documents
returns and empty list.
iboo-pro:~ danboo$ sudo perl -MFile::HomeDir? -MData::Dumper -le 'print Dumper( [ File::HomeDir?->my_documents ] )'
$VAR1 = [];
This is resulting in an odd number of hash elements starting from Padre/Config?.pm at:
http://padre.perlide.org/trac/browser/trunk/Padre/lib/Padre/Config.pm#L402
A contrived fix to maintain defined-ness under 5.8 might be:
default => do { my $d = File::HomeDir?->my_documents; defined $d ? $d : q() },
Making this change gets me a clean test as super user on Mac OSX.
Change History
comment:1 in reply to: ↑ description Changed 2 years ago by danboo
comment:3 in reply to: ↑ 2 Changed 2 years ago by danboo
- Status changed from new to closed
- Resolution set to fixed
comment:4 follow-up: ↓ 7 Changed 2 years ago by szabgab
- Status changed from closed to reopened
- Resolution fixed deleted
Let's reopen this and let Adam Kennedy comment on this and close this ticket when File::HomeDir?->my_documents is fixed - if indeed the bug is in there.
comment:7 in reply to: ↑ 4 Changed 2 years ago by danboo
Replying to szabgab:
Let's reopen this and let Adam Kennedy comment on this and close this ticket when File::HomeDir?->my_documents is fixed - if indeed the bug is in there.
I just wanted to note that the documentation for my_documents indicates that it should return undef if there is no corresponding directory. However, even if it returned undef instead of an empty list, the pre-patch code would still cause a test failure due to a test requiring all setting values to be defined.
I experienced that defined test failure with my initial change of:
default => scalar File::HomeDir->my_documents,
In summary, I think the patch is still needed, unless my_documents starts returning an empty string to indicate no document directory exists.

Replying to danboo:
Though I suppose:
would work if you want to favor cleanliness over supporting a document path of '0'.