line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FTP::Rule::Entry; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
374
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Class representing a Filesystem Entry |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
9
|
1
|
|
|
1
|
|
6
|
use experimental 'switch'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; # TRIAL |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
138
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
14
|
1
|
|
|
1
|
|
6
|
use Fcntl qw[ :mode ]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
206
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
395
|
use File::Listing qw[ parse_dir ]; |
|
1
|
|
|
|
|
3404
|
|
|
1
|
|
|
|
|
48
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
7
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use overload |
21
|
|
|
|
|
|
|
'-X' => '_statit', |
22
|
14
|
|
|
14
|
|
864
|
'bool' => sub { 1 }, |
23
|
14
|
|
|
14
|
|
443
|
'""' => sub { $_[0]->{path} }, |
24
|
1
|
|
|
1
|
|
710
|
; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
18
|
use Class::Tiny qw[ |
27
|
|
|
|
|
|
|
name type size mtime mode parent server path |
28
|
1
|
|
|
1
|
|
499
|
], { _has_attrs => 0 }; |
|
1
|
|
|
|
|
1246
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#pod =begin pod_coverage |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =head3 BUILD |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =end pod_coverage |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod =cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub BUILD { |
40
|
|
|
|
|
|
|
|
41
|
14
|
|
|
14
|
1
|
1868
|
my $self = shift; |
42
|
14
|
100
|
|
|
|
409
|
$self->_retrieve_attrs |
43
|
|
|
|
|
|
|
unless $self->_has_attrs; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _statit { |
47
|
|
|
|
|
|
|
|
48
|
33
|
|
|
33
|
|
322
|
my $self = shift; |
49
|
33
|
|
|
|
|
73
|
my $op = shift; |
50
|
|
|
|
|
|
|
|
51
|
33
|
50
|
|
|
|
862
|
$self->_retrieve_attrs |
52
|
|
|
|
|
|
|
unless $self->_has_attrs; |
53
|
|
|
|
|
|
|
|
54
|
33
|
|
|
|
|
289
|
for ( $op ) { |
55
|
|
|
|
|
|
|
|
56
|
33
|
|
|
|
|
110
|
when ( 'd' ) { return $self->is_dir } |
|
14
|
|
|
|
|
77
|
|
57
|
|
|
|
|
|
|
|
58
|
19
|
|
|
|
|
47
|
when ( 'f' ) { return $self->is_file } |
|
0
|
|
|
|
|
0
|
|
59
|
|
|
|
|
|
|
|
60
|
19
|
|
|
|
|
48
|
when ( 's' ) { return $self->size } |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
|
62
|
19
|
|
|
|
|
45
|
when ( 'z' ) { return $self->size != 0 } |
|
0
|
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
|
64
|
19
|
|
|
|
|
45
|
when ( 'r' ) { return S_IROTH & $self->mode } |
|
5
|
|
|
|
|
122
|
|
65
|
|
|
|
|
|
|
|
66
|
14
|
|
|
|
|
34
|
when ( 'R' ) { return S_IROTH & $self->mode } |
|
0
|
|
|
|
|
0
|
|
67
|
|
|
|
|
|
|
|
68
|
14
|
|
|
|
|
35
|
when ( 'l' ) { return 0 } |
|
14
|
|
|
|
|
80
|
|
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
0
|
default { croak( "unsupported file test: -$op\n" ) } |
|
0
|
|
|
|
|
0
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _get_entries { |
77
|
|
|
|
|
|
|
|
78
|
5
|
|
|
5
|
|
46
|
my ( $self, $path ) = @_; |
79
|
|
|
|
|
|
|
|
80
|
5
|
50
|
|
|
|
103
|
my $listing = $self->server->dir( $path ) |
81
|
|
|
|
|
|
|
or croak( "error listing $path" ); |
82
|
|
|
|
|
|
|
|
83
|
5
|
|
|
|
|
32474
|
my @entries; |
84
|
5
|
|
|
|
|
61
|
for my $entry ( parse_dir( $listing ) ) { |
85
|
|
|
|
|
|
|
|
86
|
13
|
|
|
|
|
5579
|
my %attr; |
87
|
13
|
|
|
|
|
119
|
@attr{qw[ name type size mtime mode]} = @$entry; |
88
|
13
|
|
|
|
|
45
|
$attr{parent} = $path; |
89
|
13
|
|
|
|
|
44
|
$attr{_has_attrs} = 1; |
90
|
|
|
|
|
|
|
|
91
|
13
|
|
|
|
|
63
|
push @entries, \%attr; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
5
|
|
|
|
|
69
|
return \@entries; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# |
100
|
|
|
|
|
|
|
# This file is part of Net-FTP-Rule |
101
|
|
|
|
|
|
|
# |
102
|
|
|
|
|
|
|
# This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
103
|
|
|
|
|
|
|
# |
104
|
|
|
|
|
|
|
# This is free software, licensed under: |
105
|
|
|
|
|
|
|
# |
106
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
107
|
|
|
|
|
|
|
# |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=pod |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 NAME |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Net::FTP::Rule::Entry - Class representing a Filesystem Entry |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 VERSION |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
version 0.01 |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 DESCRIPTION |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
A B object represents an entry in the remote |
124
|
|
|
|
|
|
|
FTP filesystem. It is rarely seen in the wild. Rather, |
125
|
|
|
|
|
|
|
L uses the subclasses B |
126
|
|
|
|
|
|
|
and B when passing paths to callbacks or |
127
|
|
|
|
|
|
|
returning paths to iterators. These subclasses have no unique methods |
128
|
|
|
|
|
|
|
or attributes of their own; they only have those of this, their parent |
129
|
|
|
|
|
|
|
class. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 mode |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
The entry mode as returned by L. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 mtime |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
The entry modification time. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 name |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The entry name. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 path |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The complete path to the entry |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 parent |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
The parent directory of the entry |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 server |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The L server object |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 size |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
The size of the entry |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 type |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The type of the entry, one of |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item f |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
file |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item d |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
directory |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item l |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
symbolic link. See however L |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item ? |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
unknown |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 METHODS |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 is_dir |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
$bool = $entry->is_dir; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
returns true if the entry is a directory. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 is_file |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$bool = $entry->is_file; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
returns true if the entry is a file. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=begin pod_coverage |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head3 BUILD |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=end pod_coverage |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
You can make new bug reports, and view existing ones, through the |
208
|
|
|
|
|
|
|
web interface at L. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 SEE ALSO |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=over 4 |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=back |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 AUTHOR |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Diab Jerius |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This is free software, licensed under: |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=cut |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
__END__ |