Ticket #737 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

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 4 years ago by danboo

Replying to danboo:

A contrived fix to maintain defined-ness under 5.8 might be:

default => do { my $d = File::HomeDir?->my_documents; defined $d ? $d : q() },

Though I suppose:

   default => File::HomeDir->my_documents || '',

would work if you want to favor cleanliness over supporting a document path of '0'.

comment:2 follow-up: ↓ 3 Changed 4 years ago by Sewi

Patched in r9126

Please test and close the ticket on success.

Thank you for helping Padre.

comment:3 in reply to: ↑ 2 Changed 4 years ago by danboo

  • Status changed from new to closed
  • Resolution set to fixed

Replying to Sewi:

Patched in r9126

Please test and close the ticket on success.

The patch works. Thanks!

comment:4 follow-up: ↓ 7 Changed 4 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:5 Changed 4 years ago by szabgab

  • Cc adamk added

comment:6 Changed 4 years ago by szabgab

  • Component changed from editor to External dependency

comment:7 in reply to: ↑ 4 Changed 4 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.

comment:8 Changed 2 years ago by bowtie

  • Status changed from reopened to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.