| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
|
2
|
|
|
|
|
|
|
#!/usr/bin/perl -d:ptkdb -w |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Data::Utilities; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
20438
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
1
|
|
|
1
|
|
4
|
use Exporter (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
16
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
102
|
|
|
15
|
1
|
|
|
1
|
|
2
|
$VERSION = '0.04'; |
|
16
|
1
|
|
|
|
|
11
|
@ISA = qw(Exporter); |
|
17
|
|
|
|
|
|
|
#Give a hoot don't pollute, do not export more than needed by default |
|
18
|
1
|
|
|
|
|
3
|
@EXPORT = qw(); |
|
19
|
1
|
|
|
|
|
2
|
@EXPORT_OK = qw(); |
|
20
|
1
|
|
|
|
|
24
|
%EXPORT_TAGS = (); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
569
|
use Data::Comparator; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
48
|
|
|
25
|
1
|
|
|
1
|
|
5
|
use Data::Differences; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
18
|
|
|
26
|
1
|
|
|
1
|
|
624
|
use Data::Merger; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
27
|
1
|
|
|
1
|
|
811
|
use Data::Transformator; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
87
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
0
|
|
|
0
|
0
|
|
my ($class, %parameters) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
0
|
|
|
|
my $self = bless ({}, ref ($class) || $class); |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return $self; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Data::Utilities - General utilities for nested perl data structures. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Data::Utilities; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $tree |
|
49
|
|
|
|
|
|
|
= { |
|
50
|
|
|
|
|
|
|
a1 => { |
|
51
|
|
|
|
|
|
|
a1 => '-a11', |
|
52
|
|
|
|
|
|
|
a2 => '-a12', |
|
53
|
|
|
|
|
|
|
}, |
|
54
|
|
|
|
|
|
|
a2 => { |
|
55
|
|
|
|
|
|
|
a1 => '-a21', |
|
56
|
|
|
|
|
|
|
a2 => '-a22', |
|
57
|
|
|
|
|
|
|
}, |
|
58
|
|
|
|
|
|
|
}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $expected_data |
|
61
|
|
|
|
|
|
|
= { |
|
62
|
|
|
|
|
|
|
a1 => { |
|
63
|
|
|
|
|
|
|
a2 => '-a12', |
|
64
|
|
|
|
|
|
|
}, |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $transformation |
|
68
|
|
|
|
|
|
|
= Data::Transformator->new |
|
69
|
|
|
|
|
|
|
( |
|
70
|
|
|
|
|
|
|
apply_identity_transformation => { |
|
71
|
|
|
|
|
|
|
a1 => { |
|
72
|
|
|
|
|
|
|
a2 => 1, |
|
73
|
|
|
|
|
|
|
}, |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
contents => $tree, |
|
76
|
|
|
|
|
|
|
name => 'test_transform5', |
|
77
|
|
|
|
|
|
|
); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $transformed_data = $transformation->transform(); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
use Data::Dumper; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
print Dumper($transformed_data); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $differences = data_comparator($transformed_data, $expected_data); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
if ($differences->is_empty()) |
|
88
|
|
|
|
|
|
|
{ |
|
89
|
|
|
|
|
|
|
print "$0: extraction ok\n"; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
else |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
|
|
|
|
|
|
print "$0: extraction failed\n"; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Data::Utilities contains general tools to transform, merge, compare |
|
100
|
|
|
|
|
|
|
nested perl data structures. See the documentation of the modules in |
|
101
|
|
|
|
|
|
|
this package as indicated below. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 USAGE |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
There are more documentation comments in Data::Transformator, for the |
|
106
|
|
|
|
|
|
|
moment I have no time to write better documentation than this. The |
|
107
|
|
|
|
|
|
|
best way to learn how to use it, is to take a look at the test cases. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The Neurospaces project (L) makes heavy |
|
110
|
|
|
|
|
|
|
use of these utilities. So you can find some examples overthere to, |
|
111
|
|
|
|
|
|
|
especially in the test framework. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Hugo Cornelis |
|
116
|
|
|
|
|
|
|
CPAN ID: CORNELIS |
|
117
|
|
|
|
|
|
|
Neurospaces Project |
|
118
|
|
|
|
|
|
|
hugo.cornelis@gmail.com |
|
119
|
|
|
|
|
|
|
http://www.neurospaces.org/ |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
124
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
127
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Data::Comparator(3), Data::Merger(3), Data::Transformator(3), |
|
133
|
|
|
|
|
|
|
Data::Differences(3). |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#################### main pod documentation end ################### |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
|
141
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
|
142
|
|
|
|
|
|
|
|