| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package File::Find::Object::PathComp; |
|
2
|
|
|
|
|
|
|
$File::Find::Object::PathComp::VERSION = '0.3.9'; |
|
3
|
7
|
|
|
7
|
|
311835
|
use strict; |
|
|
7
|
|
|
|
|
24
|
|
|
|
7
|
|
|
|
|
309
|
|
|
4
|
7
|
|
|
7
|
|
42
|
use warnings; |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
360
|
|
|
5
|
7
|
|
|
7
|
|
654
|
use integer; |
|
|
7
|
|
|
|
|
33
|
|
|
|
7
|
|
|
|
|
40
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
197
|
use parent 'File::Find::Object::Base'; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
96
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Class::XSAccessor accessors => { |
|
10
|
|
|
|
|
|
|
( |
|
11
|
7
|
|
|
|
|
21
|
map { $_ => $_ } ( |
|
|
49
|
|
|
|
|
194
|
|
|
12
|
|
|
|
|
|
|
qw( |
|
13
|
|
|
|
|
|
|
_actions |
|
14
|
|
|
|
|
|
|
_curr_file |
|
15
|
|
|
|
|
|
|
_files |
|
16
|
|
|
|
|
|
|
_last_dir_scanned |
|
17
|
|
|
|
|
|
|
_open_dir_ret |
|
18
|
|
|
|
|
|
|
_stat_ret |
|
19
|
|
|
|
|
|
|
_traverse_to |
|
20
|
|
|
|
|
|
|
) |
|
21
|
|
|
|
|
|
|
) |
|
22
|
|
|
|
|
|
|
) |
|
23
|
|
|
|
|
|
|
}, |
|
24
|
|
|
|
|
|
|
getters => { _inodes => '_inodes' }, |
|
25
|
|
|
|
|
|
|
setters => { _set_inodes => '_inodes' }, |
|
26
|
7
|
|
|
7
|
|
2441
|
; |
|
|
7
|
|
|
|
|
15
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
7
|
|
|
7
|
|
4355
|
use File::Spec (); |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
4144
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__PACKAGE__->_make_copy_methods( |
|
31
|
|
|
|
|
|
|
[ |
|
32
|
|
|
|
|
|
|
qw( |
|
33
|
|
|
|
|
|
|
_files |
|
34
|
|
|
|
|
|
|
_traverse_to |
|
35
|
|
|
|
|
|
|
) |
|
36
|
|
|
|
|
|
|
] |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _dev |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
88
|
|
|
88
|
|
426
|
return shift->_stat_ret->[0]; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _inode |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
71
|
|
|
71
|
|
244
|
return shift->_stat_ret->[1]; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _is_same_inode |
|
50
|
|
|
|
|
|
|
{ |
|
51
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# $st is an array ref with the return of perldoc -f stat . |
|
54
|
0
|
|
|
|
|
0
|
my $st = shift; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# On MS-Windows, all inodes in stat are returned as 0, so we need to |
|
57
|
|
|
|
|
|
|
# check that both inodes are not zero. This is why there's the |
|
58
|
|
|
|
|
|
|
# $self->_inode() != 0 check at the end. |
|
59
|
0
|
|
0
|
|
|
0
|
return ( $self->_dev() == $st->[0] |
|
60
|
|
|
|
|
|
|
&& $self->_inode() == $st->[1] |
|
61
|
|
|
|
|
|
|
&& $self->_inode() != 0 ); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _should_scan_dir |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
64
|
|
|
64
|
|
98
|
my $self = shift; |
|
67
|
64
|
|
|
|
|
96
|
my $dir_str = shift; |
|
68
|
|
|
|
|
|
|
|
|
69
|
64
|
100
|
100
|
|
|
294
|
if ( defined( $self->_last_dir_scanned() ) |
|
70
|
|
|
|
|
|
|
&& ( $self->_last_dir_scanned() eq $dir_str ) ) |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
7
|
|
|
|
|
20
|
return; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
else |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
57
|
|
|
|
|
161
|
$self->_last_dir_scanned($dir_str); |
|
77
|
57
|
|
|
|
|
143
|
return 1; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _set_up_dir |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
57
|
|
|
57
|
|
81
|
my $self = shift; |
|
84
|
57
|
|
|
|
|
86
|
my $dir_str = shift; |
|
85
|
|
|
|
|
|
|
|
|
86
|
57
|
|
|
|
|
131
|
$self->_files( $self->_calc_dir_files($dir_str) ); |
|
87
|
|
|
|
|
|
|
|
|
88
|
57
|
|
|
|
|
212
|
$self->_traverse_to( $self->_files_copy() ); |
|
89
|
|
|
|
|
|
|
|
|
90
|
57
|
|
|
|
|
433
|
return $self->_open_dir_ret(1); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub _calc_dir_files |
|
94
|
|
|
|
|
|
|
{ |
|
95
|
57
|
|
|
57
|
|
86
|
my $self = shift; |
|
96
|
57
|
|
|
|
|
91
|
my $dir_str = shift; |
|
97
|
|
|
|
|
|
|
|
|
98
|
57
|
|
|
|
|
97
|
my $handle; |
|
99
|
|
|
|
|
|
|
my @files; |
|
100
|
57
|
100
|
|
|
|
3572
|
if ( !opendir( $handle, $dir_str ) ) |
|
101
|
|
|
|
|
|
|
{ |
|
102
|
|
|
|
|
|
|
# Handle this error gracefully. |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
else |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
|
|
|
|
|
|
@files = |
|
107
|
54
|
|
|
|
|
2523
|
( sort { $a cmp $b } File::Spec->no_upwards( readdir($handle) ) ); |
|
|
55
|
|
|
|
|
194
|
|
|
108
|
54
|
|
|
|
|
796
|
closedir($handle); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
57
|
|
|
|
|
401
|
return \@files; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _component_open_dir |
|
115
|
|
|
|
|
|
|
{ |
|
116
|
64
|
|
|
64
|
|
96
|
my $self = shift; |
|
117
|
64
|
|
|
|
|
101
|
my $dir_str = shift; |
|
118
|
|
|
|
|
|
|
|
|
119
|
64
|
100
|
|
|
|
163
|
if ( !$self->_should_scan_dir($dir_str) ) |
|
120
|
|
|
|
|
|
|
{ |
|
121
|
7
|
|
|
|
|
37
|
return $self->_open_dir_ret(); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
57
|
|
|
|
|
138
|
return $self->_set_up_dir($dir_str); |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub _next_traverse_to |
|
128
|
|
|
|
|
|
|
{ |
|
129
|
115
|
|
|
115
|
|
189
|
my $self = shift; |
|
130
|
|
|
|
|
|
|
|
|
131
|
115
|
|
|
|
|
147
|
return shift( @{ $self->_traverse_to() } ); |
|
|
115
|
|
|
|
|
550
|
|
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
1; |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
__END__ |