File Coverage

blib/lib/Path/IsDev/NegativeHeuristic/HomeDir.pm
Criterion Covered Total %
statement 27 28 96.4
branch 3 6 50.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 40 44 90.9


line stmt bran cond sub pod time code
1 12     12   4455 use 5.008; # utf8
  12         26  
2 12     12   43 use strict;
  12         17  
  12         195  
3 12     12   36 use warnings;
  12         10  
  12         264  
4 12     12   465 use utf8;
  12         18  
  12         49  
5              
6             package Path::IsDev::NegativeHeuristic::HomeDir;
7              
8             our $VERSION = '1.001003';
9              
10             # ABSTRACT: User home directories are not development roots
11              
12             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13              
14             ## no critic (RequireArgUnpacking, ProhibitSubroutinePrototypes)
15             sub _uniq (@) {
16 16     16   38 my %seen = ();
17 16         25 return grep { not $seen{$_}++ } @_;
  112         241  
18             }
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35 12     12   1529 use Role::Tiny::With qw( with );
  12         3452  
  12         2218  
36             with 'Path::IsDev::Role::NegativeHeuristic', 'Path::IsDev::Role::Matcher::FullPath::Is::Any';
37              
38              
39              
40              
41              
42              
43              
44              
45              
46              
47              
48              
49              
50              
51              
52              
53             sub paths {
54 16     16 1 16 my @sources;
55 16         4641 require File::HomeDir;
56 16         45211 push @sources, File::HomeDir->my_home;
57 16         393 for my $method (qw( my_home my_desktop my_music my_pictures my_videos my_data )) {
58 96 50       1413 if ( $File::HomeDir::IMPLEMENTED_BY->can($method) ) {
59 96         199 push @sources, File::HomeDir->$method();
60             }
61             }
62 16 50       251 return _uniq grep { defined and length } @sources;
  112         356  
63             }
64              
65              
66              
67              
68              
69              
70              
71             sub excludes {
72 16     16 1 30 my ( $self, $result_object ) = @_;
73 16 50       44 return unless $self->fullpath_is_any( $result_object, $self->paths );
74 0           return 1;
75             }
76             1;
77              
78             __END__