line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyData2::Format::FileSystem; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
678
|
use 5.008001; |
|
1
|
|
|
|
|
2
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
2
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use base qw(AnyData2::Format); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
305
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use Carp 'croak'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
10
|
1
|
|
|
1
|
|
3
|
use File::Spec (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
155
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
AnyData2::Format::FileSystem - FileSystem format class for AnyData2 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 new |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# pure |
25
|
|
|
|
|
|
|
my $af = AnyData2::Format::FileSystem->new( |
26
|
|
|
|
|
|
|
AnyData2::Storage::FileSystem->new( dirname => $ENV{HOME} ) |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
constructs a filesystem format |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new |
34
|
|
|
|
|
|
|
{ |
35
|
1
|
|
|
1
|
1
|
2
|
my ( $class, $storage, %options ) = @_; |
36
|
1
|
|
|
|
|
6
|
my $self = $class->SUPER::new($storage); |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
4
|
$self->{fs_cols} = [qw(entry dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks)]; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
2
|
$self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 cols |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Return column names |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub cols |
50
|
|
|
|
|
|
|
{ |
51
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
52
|
1
|
50
|
|
|
|
3
|
defined $self->{fs_cols} or croak "Should not been here ..."; |
53
|
1
|
|
|
|
|
2
|
$self->{fs_cols}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 fetchrow |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Fetch next directory entry and return name and stat values |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub fetchrow |
63
|
|
|
|
|
|
|
{ |
64
|
5
|
|
|
5
|
1
|
17
|
my $self = shift; |
65
|
5
|
|
|
|
|
9
|
my $entry = $self->{storage}->read(); |
66
|
5
|
100
|
|
|
|
7
|
defined $entry or return; |
67
|
4
|
|
|
|
|
23
|
my $fqpn = File::Spec->catfile( $self->{storage}->{dirname}, $entry ); |
68
|
4
|
|
|
|
|
49
|
[ $entry, stat $fqpn ]; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 pushrow |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
No idea how this can be reasonable implemented |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub pushrow |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
0
|
1
|
|
croak "read-only format ..."; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Copyright 2015,2016 Jens Rehsack. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
87
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
88
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
93
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
94
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
97
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
100
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
101
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
102
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
103
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
104
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
105
|
|
|
|
|
|
|
direct or contributory patent infringement, then this License |
106
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
109
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
110
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
111
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
112
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
113
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
114
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
115
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|