File Coverage

blib/lib/App/chot/Finder.pm
Criterion Covered Total %
statement 5 12 41.6
branch n/a
condition n/a
subroutine 2 8 25.0
pod 1 6 16.6
total 8 26 30.7


line stmt bran cond sub pod time code
1             package App::chot::Finder;
2 1     1   2533 use v5.14;
  1         5  
3 1     1   26 use warnings;
  1         2  
  1         303  
4              
5             =head1 DESCRIPTION
6              
7             Base class for all chot finder modules (Command, Perl, Python, Ruby, Node).
8              
9             Subclasses inherit C and accessor methods, and override finder methods.
10              
11             Finder contract:
12              
13             =over 4
14              
15             =item B (required)
16              
17             Returns a list of file paths found for the target name.
18              
19             =item B (optional)
20              
21             Prints trace/resolution info to STDERR for C<-i> mode.
22              
23             =item B (optional)
24              
25             Returns a command list for displaying documentation.
26             Returns empty list to skip (allowing fallback to the next finder).
27              
28             =back
29              
30             =cut
31              
32             sub new {
33 0     0 0   my($class, %args) = @_;
34             bless {
35             app => $args{app}, # App::chot option object
36             name => $args{name}, # target command/module name
37             found => $args{found}, # App::chot::Found shared results
38 0           }, $class;
39             }
40              
41             #
42             # lvalue accessors: readable and writable (e.g., $self->name = 'foo')
43             #
44 0     0 0   sub app : lvalue { $_[0]{app} }
45 0     0 0   sub name : lvalue { $_[0]{name} }
46 0     0 0   sub found : lvalue { $_[0]{found} }
47              
48             #
49             # Shortcut for $self->app->debug
50             #
51 0     0 0   sub debug { $_[0]{app}->debug }
52              
53             #
54             # Default: return empty list (subclasses override)
55             #
56 0     0 1   sub get_path { () }
57              
58             1;