line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# App::GitFind::Entry::OnDisk - a file or directory on disk |
2
|
|
|
|
|
|
|
package App::GitFind::Entry::OnDisk; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
14
|
use 5.010; |
|
1
|
|
|
|
|
2
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
7
|
1
|
|
|
1
|
|
4
|
use App::GitFind::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
88
|
|
8
|
|
|
|
|
|
|
#use Path::Class; |
9
|
1
|
|
|
1
|
|
475
|
use App::GitFind::PathClassMicro; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.000002'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
use parent 'App::GitFind::Entry'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Fields. Not all have values. |
16
|
|
|
|
|
|
|
use Class::Tiny |
17
|
1
|
|
|
|
|
3
|
'obj', # A File::Find::Object::Result instance. Required. |
18
|
1
|
|
|
1
|
|
40
|
'findbase'; # Where the search started from |
|
1
|
|
|
|
|
2
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Class::Tiny::Immutable { |
21
|
0
|
|
|
|
|
|
_lstat => sub { $_[0]->obj->stat_ret }, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Lazy App::GitFind::PathClassMicro; |
24
|
|
|
|
|
|
|
_pathclass => sub { |
25
|
|
|
|
|
|
|
($_[0]->isdir ? 'App::GitFind::PathClassMicro::Dir' |
26
|
|
|
|
|
|
|
: 'App::GitFind::PathClassMicro::File' |
27
|
|
|
|
|
|
|
)->new( |
28
|
0
|
0
|
|
|
|
|
$_[0]->findbase, @{$_[0]->obj->full_components} |
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
) |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
isdir => sub { $_[0]->obj->is_dir }, |
33
|
|
|
|
|
|
|
name => sub { # basename, whether it's a file or directory |
34
|
0
|
|
|
|
|
|
my @x = $_[0]->obj->full_components; |
35
|
0
|
|
|
|
|
|
$x[$#x] |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
path => sub { $_[0]->_pathclass->relative($_[0]->searchbase) }, |
39
|
1
|
|
|
1
|
|
422
|
}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Docs {{{1 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# App::GitFind::Entry::OnDisk - an App::GitFind::Entry representing a file or directory on disk |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This represents a single file or directory being checked against an expression. |
50
|
|
|
|
|
|
|
This particular concrete class represents a file or directory on disk. |
51
|
|
|
|
|
|
|
It requires a L<File::Find::Object::Result> instance. Usage: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $obj = File::Find::Object->new(...)->next_obj; |
54
|
|
|
|
|
|
|
my $entry = App::GitFind::Entry::OnDisk->new(-obj => $obj); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# }}}1 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 prune |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
If this entry represents a directory, mark its children as not to be traversed. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
If this entry represents a file, no effect. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub prune { |
71
|
|
|
|
|
|
|
... |
72
|
0
|
|
|
0
|
1
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 BUILD |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Enforces the requirements on the C<-obj> argument to C<new()>. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub BUILD { |
81
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
82
|
0
|
0
|
|
|
|
|
die "Usage: @{[ref $self]}->new(-obj=>...)" |
|
0
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
unless $self->obj; |
84
|
0
|
0
|
|
|
|
|
die "-obj must be a File::Find::Object::Result" |
85
|
|
|
|
|
|
|
unless $self->obj->DOES('File::Find::Object::Result'); |
86
|
|
|
|
|
|
|
} #BUILD() |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |