Skip to content
Browse files

Try to avoid failing on a few Win32's where for some banal reason, my…

…_* don't work at all
  • Loading branch information...
1 parent 6cf8812 commit 46aa0f896c74e3c502189c3e484cc5c6f82a6c67 @kentfredric kentfredric committed
Showing with 7 additions and 8 deletions.
  1. +7 −8 lib/Path/IsDev/NegativeHeuristic/HomeDir.pm
View
15 lib/Path/IsDev/NegativeHeuristic/HomeDir.pm
@@ -30,8 +30,6 @@ sub _uniq (@) {
use Role::Tiny::With;
with 'Path::IsDev::Role::NegativeHeuristic', 'Path::IsDev::Role::Matcher::FullPath::Is::Any';
-sub _fhd { require File::HomeDir; return 'File::HomeDir' }
-
=method C<paths>
Excludes any values returned by L<< C<File::HomeDir>|File::HomeDir >>
@@ -49,12 +47,13 @@ Excludes any values returned by L<< C<File::HomeDir>|File::HomeDir >>
sub paths {
my @sources;
- push @sources, _fhd()->my_home;
- push @sources, _fhd()->my_desktop;
- push @sources, _fhd()->my_music;
- push @sources, _fhd()->my_pictures;
- push @sources, _fhd()->my_videos;
- push @sources, _fhd()->my_data;
+ require File::HomeDir;
+ push @sources, File::HomeDir->my_home;
+ for my $method (qw( my_home my_desktop my_music my_pictures my_videos my_data )) {
+ if ( $File::HomeDir::IMPLEMENTED_BY->can($method) ) {
+ push @sources, File::HomeDir->$method();
+ }
+ }
return _uniq grep { defined and length } @sources;
}

0 comments on commit 46aa0f8

Please sign in to comment.
Something went wrong with that request. Please try again.