-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
160 lines (95 loc) · 3.43 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
NAME
Data::Transpose - iterate, filter and validate data, and transpose to
different field names
DESCRIPTION
Caters to your needs for manipulating data by different operations,
which are filtering records, iterating records, validating and
transposing to different field names.
VERSION
Version 0.0023
SYNOPSIS
use warnings;
use strict;
use Data::Transpose::Prefix;
use Data::Dumper;
my $data = {
first => 'John',
last => 'Doe',
foo => 'bar',
};
my $dtp = Data::Transpose::Prefix->new(prefix => 'user.');
foreach my $needs_prefix ( qw(first last) ) {
$dtp->field( $needs_prefix );
}
my $output = $dtp->transpose( $data );
print Data::Dumper->Dump([$data, $output], [qw(data output)]);
outputs:
$data = {
'first' => 'John',
'last' => 'Doe',
'foo' => 'bar'
};
$output = {
'user.last' => 'Doe',
'user.first' => 'John',
'foo' => 'bar'
};
REFERENCE
Validator
Data::Transpose::Validator
Iterator
Data::Transpose::Iterator
METHODS
new
Parameters for the constructor are:
unknown
Determines how to treat fields in the input hash which are not known
to the Data::Transpose object:
fail
The transpose operation fails.
pass
Unknown fields in the input hash appear in the output hash. This is
the default behaviour.
skip
Unknown fields in the input hash don't appear in the output hash.
This doesn't apply to the "transpose_object" method.
field
Add a new field object and return it:
$tp->field('email');
group
Add a new group object and return it:
$tp->group('fullname', $tp->field('firstname'), $tp->field('lastname'));
transpose
Transposes input:
$new_record = $tp->transpose($orig_record);
transpose_object
Transposes an object into a hash reference.
AUTHOR
Stefan Hornburg (Racke), <racke at linuxia.de>
BUGS
Please report any bugs or feature requests at
https://github.com/racke/Data-Transpose/issues. I will be notified, and
then you'll automatically be notified of progress on your bug as I make
changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Data::Transpose
You can also look for information at:
* Github's issue tracker (report bugs here)
https://github.com/racke/Data-Transpose/issues
* AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Data-Transpose
* CPAN Ratings
http://cpanratings.perl.org/d/Data-Transpose
* Search CPAN
http://search.cpan.org/dist/Data-Transpose/
ACKNOWLEDGEMENTS
Peter Mottram (GH #19, #28). Lisa Hare (GH #27). Marco Pessotto (GH #6,
#7, #14, #24, #26). Slaven Rezić (GH #25). Sam Batschelet (GH #16,
#18). Todd Wade (GH #5, #11, #12, #13).
LICENSE AND COPYRIGHT
Copyright 2012-2016 Stefan Hornburg (Racke).
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.