line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyData2; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
22022
|
use 5.008001; |
|
4
|
|
|
|
|
9
|
|
4
|
4
|
|
|
4
|
|
12
|
use strict; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
73
|
|
5
|
4
|
|
|
4
|
|
12
|
use warnings FATAL => 'all'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
125
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1607
|
use Module::Runtime qw(require_module); |
|
4
|
|
|
|
|
4582
|
|
|
4
|
|
|
|
|
20
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
AnyData2 - access to data in many formats |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use AnyData2 (); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $ad = AnyData2->new( $src_format => { %src_format_flags }, |
22
|
|
|
|
|
|
|
$src_storage => { %src_storage_flags } ); |
23
|
|
|
|
|
|
|
my $ad_out = AnyData2->new( $tgt_format => { %tgt_format_flags }, |
24
|
|
|
|
|
|
|
$tgt_storage => { %tgt_storage_flags } ); |
25
|
|
|
|
|
|
|
while( my $datum = $ad->read ) { |
26
|
|
|
|
|
|
|
$ad_out->write( $datum ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The rather wacky idea behind this module is that any data, regardless of |
32
|
|
|
|
|
|
|
source or format should be accessible and maybe modifiable with the same |
33
|
|
|
|
|
|
|
simple set of methods. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
AnyData2 is reduced to the maximum, all extended features like tied access, |
36
|
|
|
|
|
|
|
import from a different source, automatic conversion on export etc. should |
37
|
|
|
|
|
|
|
be done in external logic. This will make the core more maintainable. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 new |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $af = AnyData->new( |
44
|
|
|
|
|
|
|
CSV => {}, |
45
|
|
|
|
|
|
|
"File::Linewise" => { filename => File::Spec->catfile( $test_dir, "simple.csv" ) } |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Instantiates a combination of AnyData::Storage and AnyData::Parser. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
C and C are automatically prepended |
51
|
|
|
|
|
|
|
when necessary. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub new |
56
|
|
|
|
|
|
|
{ |
57
|
3
|
|
|
3
|
1
|
931
|
my ( $class, $fmt, $fmt_flags, $stor, $stor_flags ) = @_; |
58
|
3
|
50
|
|
|
|
14
|
$stor =~ m/^AnyData2::Storage::/ or $stor = "AnyData2::Storage::" . $stor; |
59
|
3
|
50
|
|
|
|
12
|
$fmt =~ m/^AnyData2::Format::/ or $fmt = "AnyData2::Format::" . $fmt; |
60
|
3
|
|
|
|
|
11
|
require_module($stor); |
61
|
3
|
|
|
|
|
137
|
require_module($fmt); |
62
|
3
|
|
|
|
|
57
|
my $s = $stor->new(%$stor_flags); |
63
|
3
|
|
|
|
|
17
|
$fmt->new( $s, %$fmt_flags ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Jens Rehsack, C<< >> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 BUGS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
73
|
|
|
|
|
|
|
or through the web interface at L. |
74
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress |
75
|
|
|
|
|
|
|
on your bug as I make changes. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SUPPORT |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
perldoc AnyData2 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
You can also look for information at: |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over 4 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * CPAN Ratings |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * Search CPAN |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright 2015,2016 Jens Rehsack. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
112
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
113
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
118
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
119
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
122
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
125
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
126
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
127
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
128
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
129
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
130
|
|
|
|
|
|
|
direct or contributory patent infringement, then this License |
131
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
134
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
135
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
136
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
137
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
138
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
139
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
140
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
1; # End of AnyData2 |