line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This file was autogenerated. |
2
|
2
|
|
|
2
|
|
224812
|
use 5.008001; |
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
41
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
5
|
2
|
|
|
2
|
|
10
|
no warnings qw( void once ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
6
|
2
|
|
|
2
|
|
378
|
use Hydrogen (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
7
|
2
|
|
|
2
|
|
457
|
use Hydrogen::HashRef (); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
154
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Hydrogen::Curry::HashRef; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
12
|
|
|
|
|
|
|
our $VERSION = '0.017'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Hydrogen::Curry::HashRef - easily curry functions from Hydrogen::HashRef |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This documentation is for Hydrogen::Curry::HashRef 0.017, |
21
|
|
|
|
|
|
|
which is based on Sub::HandlesVia::HandlerLibrary::Hash 0.038. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 FUNCTIONS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Each function expects a reference to a hash as its only argument and returns a coderef. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
11
|
use Exporter::Shiny qw( |
32
|
|
|
|
|
|
|
curry_accessor |
33
|
|
|
|
|
|
|
curry_all |
34
|
|
|
|
|
|
|
curry_clear |
35
|
|
|
|
|
|
|
curry_count |
36
|
|
|
|
|
|
|
curry_defined |
37
|
|
|
|
|
|
|
curry_delete |
38
|
|
|
|
|
|
|
curry_delete_where |
39
|
|
|
|
|
|
|
curry_elements |
40
|
|
|
|
|
|
|
curry_exists |
41
|
|
|
|
|
|
|
curry_for_each_key |
42
|
|
|
|
|
|
|
curry_for_each_pair |
43
|
|
|
|
|
|
|
curry_for_each_value |
44
|
|
|
|
|
|
|
curry_get |
45
|
|
|
|
|
|
|
curry_is_empty |
46
|
|
|
|
|
|
|
curry_keys |
47
|
|
|
|
|
|
|
curry_kv |
48
|
|
|
|
|
|
|
curry_reset |
49
|
|
|
|
|
|
|
curry_set |
50
|
|
|
|
|
|
|
curry_shallow_clone |
51
|
|
|
|
|
|
|
curry_sorted_keys |
52
|
|
|
|
|
|
|
curry_values |
53
|
2
|
|
|
2
|
|
15
|
); |
|
2
|
|
|
|
|
4
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 C<< curry_accessor( $hashref ) >> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::accessor >>. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub curry_accessor { |
62
|
1
|
50
|
|
1
|
1
|
7247
|
@_ == 1 |
63
|
|
|
|
|
|
|
or Hydrogen::croak( |
64
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_accessor: got %d, %s", |
65
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
66
|
|
|
|
|
|
|
); |
67
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
68
|
|
|
|
|
|
|
or Hydrogen::croak( |
69
|
|
|
|
|
|
|
"Type check failed in signature for curry_accessor: %s should be %s", |
70
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
71
|
|
|
|
|
|
|
); |
72
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
73
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::accessor( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 C<< curry_all( $hashref ) >> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::all >>. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub curry_all { |
83
|
1
|
50
|
|
1
|
1
|
3394
|
@_ == 1 |
84
|
|
|
|
|
|
|
or Hydrogen::croak( |
85
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_all: got %d, %s", |
86
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
87
|
|
|
|
|
|
|
); |
88
|
1
|
50
|
|
|
|
6
|
(ref($_[0]) eq 'HASH') |
89
|
|
|
|
|
|
|
or Hydrogen::croak( |
90
|
|
|
|
|
|
|
"Type check failed in signature for curry_all: %s should be %s", |
91
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
92
|
|
|
|
|
|
|
); |
93
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
94
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::all( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 C<< curry_clear( $hashref ) >> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::clear >>. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub curry_clear { |
104
|
1
|
50
|
|
1
|
1
|
2800
|
@_ == 1 |
105
|
|
|
|
|
|
|
or Hydrogen::croak( |
106
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_clear: got %d, %s", |
107
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
108
|
|
|
|
|
|
|
); |
109
|
1
|
50
|
|
|
|
9
|
(ref($_[0]) eq 'HASH') |
110
|
|
|
|
|
|
|
or Hydrogen::croak( |
111
|
|
|
|
|
|
|
"Type check failed in signature for curry_clear: %s should be %s", |
112
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
113
|
|
|
|
|
|
|
); |
114
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
115
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::clear( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 C<< curry_count( $hashref ) >> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::count >>. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub curry_count { |
125
|
1
|
50
|
|
1
|
1
|
2816
|
@_ == 1 |
126
|
|
|
|
|
|
|
or Hydrogen::croak( |
127
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_count: got %d, %s", |
128
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
129
|
|
|
|
|
|
|
); |
130
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
131
|
|
|
|
|
|
|
or Hydrogen::croak( |
132
|
|
|
|
|
|
|
"Type check failed in signature for curry_count: %s should be %s", |
133
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
134
|
|
|
|
|
|
|
); |
135
|
1
|
|
|
|
|
2
|
my $ref = \$_[0]; |
136
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::count( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 C<< curry_defined( $hashref ) >> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::defined >>. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub curry_defined { |
146
|
1
|
50
|
|
1
|
1
|
2762
|
@_ == 1 |
147
|
|
|
|
|
|
|
or Hydrogen::croak( |
148
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_defined: got %d, %s", |
149
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
150
|
|
|
|
|
|
|
); |
151
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
152
|
|
|
|
|
|
|
or Hydrogen::croak( |
153
|
|
|
|
|
|
|
"Type check failed in signature for curry_defined: %s should be %s", |
154
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
155
|
|
|
|
|
|
|
); |
156
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
157
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::defined( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 C<< curry_delete( $hashref ) >> |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::delete >>. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub curry_delete { |
167
|
1
|
50
|
|
1
|
1
|
2793
|
@_ == 1 |
168
|
|
|
|
|
|
|
or Hydrogen::croak( |
169
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_delete: got %d, %s", |
170
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
171
|
|
|
|
|
|
|
); |
172
|
1
|
50
|
|
|
|
7
|
(ref($_[0]) eq 'HASH') |
173
|
|
|
|
|
|
|
or Hydrogen::croak( |
174
|
|
|
|
|
|
|
"Type check failed in signature for curry_delete: %s should be %s", |
175
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
176
|
|
|
|
|
|
|
); |
177
|
1
|
|
|
|
|
2
|
my $ref = \$_[0]; |
178
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::delete( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 C<< curry_delete_where( $hashref ) >> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::delete_where >>. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub curry_delete_where { |
188
|
1
|
50
|
|
1
|
1
|
2778
|
@_ == 1 |
189
|
|
|
|
|
|
|
or Hydrogen::croak( |
190
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_delete_where: got %d, %s", |
191
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
192
|
|
|
|
|
|
|
); |
193
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
194
|
|
|
|
|
|
|
or Hydrogen::croak( |
195
|
|
|
|
|
|
|
"Type check failed in signature for curry_delete_where: %s should be %s", |
196
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
197
|
|
|
|
|
|
|
); |
198
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
199
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::delete_where( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head2 C<< curry_elements( $hashref ) >> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::elements >>. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub curry_elements { |
209
|
1
|
50
|
|
1
|
1
|
2794
|
@_ == 1 |
210
|
|
|
|
|
|
|
or Hydrogen::croak( |
211
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_elements: got %d, %s", |
212
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
213
|
|
|
|
|
|
|
); |
214
|
1
|
50
|
|
|
|
8
|
(ref($_[0]) eq 'HASH') |
215
|
|
|
|
|
|
|
or Hydrogen::croak( |
216
|
|
|
|
|
|
|
"Type check failed in signature for curry_elements: %s should be %s", |
217
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
218
|
|
|
|
|
|
|
); |
219
|
1
|
|
|
|
|
2
|
my $ref = \$_[0]; |
220
|
1
|
|
|
0
|
|
6
|
return sub { Hydrogen::HashRef::elements( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 C<< curry_exists( $hashref ) >> |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::exists >>. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub curry_exists { |
230
|
1
|
50
|
|
1
|
1
|
2745
|
@_ == 1 |
231
|
|
|
|
|
|
|
or Hydrogen::croak( |
232
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_exists: got %d, %s", |
233
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
234
|
|
|
|
|
|
|
); |
235
|
1
|
50
|
|
|
|
4
|
(ref($_[0]) eq 'HASH') |
236
|
|
|
|
|
|
|
or Hydrogen::croak( |
237
|
|
|
|
|
|
|
"Type check failed in signature for curry_exists: %s should be %s", |
238
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
239
|
|
|
|
|
|
|
); |
240
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
241
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::exists( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 C<< curry_for_each_key( $hashref ) >> |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::for_each_key >>. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=cut |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub curry_for_each_key { |
251
|
1
|
50
|
|
1
|
1
|
2868
|
@_ == 1 |
252
|
|
|
|
|
|
|
or Hydrogen::croak( |
253
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_for_each_key: got %d, %s", |
254
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
255
|
|
|
|
|
|
|
); |
256
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
257
|
|
|
|
|
|
|
or Hydrogen::croak( |
258
|
|
|
|
|
|
|
"Type check failed in signature for curry_for_each_key: %s should be %s", |
259
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
260
|
|
|
|
|
|
|
); |
261
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
262
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::for_each_key( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 C<< curry_for_each_pair( $hashref ) >> |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::for_each_pair >>. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
sub curry_for_each_pair { |
272
|
1
|
50
|
|
1
|
1
|
2798
|
@_ == 1 |
273
|
|
|
|
|
|
|
or Hydrogen::croak( |
274
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_for_each_pair: got %d, %s", |
275
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
276
|
|
|
|
|
|
|
); |
277
|
1
|
50
|
|
|
|
9
|
(ref($_[0]) eq 'HASH') |
278
|
|
|
|
|
|
|
or Hydrogen::croak( |
279
|
|
|
|
|
|
|
"Type check failed in signature for curry_for_each_pair: %s should be %s", |
280
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
281
|
|
|
|
|
|
|
); |
282
|
1
|
|
|
|
|
4
|
my $ref = \$_[0]; |
283
|
1
|
|
|
0
|
|
6
|
return sub { Hydrogen::HashRef::for_each_pair( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head2 C<< curry_for_each_value( $hashref ) >> |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::for_each_value >>. |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=cut |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
sub curry_for_each_value { |
293
|
1
|
50
|
|
1
|
1
|
2777
|
@_ == 1 |
294
|
|
|
|
|
|
|
or Hydrogen::croak( |
295
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_for_each_value: got %d, %s", |
296
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
297
|
|
|
|
|
|
|
); |
298
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
299
|
|
|
|
|
|
|
or Hydrogen::croak( |
300
|
|
|
|
|
|
|
"Type check failed in signature for curry_for_each_value: %s should be %s", |
301
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
302
|
|
|
|
|
|
|
); |
303
|
1
|
|
|
|
|
4
|
my $ref = \$_[0]; |
304
|
1
|
|
|
0
|
|
6
|
return sub { Hydrogen::HashRef::for_each_value( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head2 C<< curry_get( $hashref ) >> |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::get >>. |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=cut |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
sub curry_get { |
314
|
1
|
50
|
|
1
|
1
|
2757
|
@_ == 1 |
315
|
|
|
|
|
|
|
or Hydrogen::croak( |
316
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_get: got %d, %s", |
317
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
318
|
|
|
|
|
|
|
); |
319
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
320
|
|
|
|
|
|
|
or Hydrogen::croak( |
321
|
|
|
|
|
|
|
"Type check failed in signature for curry_get: %s should be %s", |
322
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
323
|
|
|
|
|
|
|
); |
324
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
325
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::get( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head2 C<< curry_is_empty( $hashref ) >> |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::is_empty >>. |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=cut |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub curry_is_empty { |
335
|
1
|
50
|
|
1
|
1
|
2786
|
@_ == 1 |
336
|
|
|
|
|
|
|
or Hydrogen::croak( |
337
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_is_empty: got %d, %s", |
338
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
339
|
|
|
|
|
|
|
); |
340
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
341
|
|
|
|
|
|
|
or Hydrogen::croak( |
342
|
|
|
|
|
|
|
"Type check failed in signature for curry_is_empty: %s should be %s", |
343
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
344
|
|
|
|
|
|
|
); |
345
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
346
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::is_empty( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head2 C<< curry_keys( $hashref ) >> |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::keys >>. |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=cut |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub curry_keys { |
356
|
1
|
50
|
|
1
|
1
|
2776
|
@_ == 1 |
357
|
|
|
|
|
|
|
or Hydrogen::croak( |
358
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_keys: got %d, %s", |
359
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
360
|
|
|
|
|
|
|
); |
361
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
362
|
|
|
|
|
|
|
or Hydrogen::croak( |
363
|
|
|
|
|
|
|
"Type check failed in signature for curry_keys: %s should be %s", |
364
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
365
|
|
|
|
|
|
|
); |
366
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
367
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::keys( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=head2 C<< curry_kv( $hashref ) >> |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::kv >>. |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=cut |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub curry_kv { |
377
|
1
|
50
|
|
1
|
1
|
2764
|
@_ == 1 |
378
|
|
|
|
|
|
|
or Hydrogen::croak( |
379
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_kv: got %d, %s", |
380
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
381
|
|
|
|
|
|
|
); |
382
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
383
|
|
|
|
|
|
|
or Hydrogen::croak( |
384
|
|
|
|
|
|
|
"Type check failed in signature for curry_kv: %s should be %s", |
385
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
386
|
|
|
|
|
|
|
); |
387
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
388
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::kv( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=head2 C<< curry_reset( $hashref ) >> |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::reset >>. |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=cut |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
sub curry_reset { |
398
|
1
|
50
|
|
1
|
1
|
2782
|
@_ == 1 |
399
|
|
|
|
|
|
|
or Hydrogen::croak( |
400
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_reset: got %d, %s", |
401
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
402
|
|
|
|
|
|
|
); |
403
|
1
|
50
|
|
|
|
6
|
(ref($_[0]) eq 'HASH') |
404
|
|
|
|
|
|
|
or Hydrogen::croak( |
405
|
|
|
|
|
|
|
"Type check failed in signature for curry_reset: %s should be %s", |
406
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
407
|
|
|
|
|
|
|
); |
408
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
409
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::reset( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=head2 C<< curry_set( $hashref ) >> |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::set >>. |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=cut |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
sub curry_set { |
419
|
1
|
50
|
|
1
|
1
|
2786
|
@_ == 1 |
420
|
|
|
|
|
|
|
or Hydrogen::croak( |
421
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_set: got %d, %s", |
422
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
423
|
|
|
|
|
|
|
); |
424
|
1
|
50
|
|
|
|
4
|
(ref($_[0]) eq 'HASH') |
425
|
|
|
|
|
|
|
or Hydrogen::croak( |
426
|
|
|
|
|
|
|
"Type check failed in signature for curry_set: %s should be %s", |
427
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
428
|
|
|
|
|
|
|
); |
429
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
430
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::set( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=head2 C<< curry_shallow_clone( $hashref ) >> |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::shallow_clone >>. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=cut |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
sub curry_shallow_clone { |
440
|
1
|
50
|
|
1
|
1
|
2766
|
@_ == 1 |
441
|
|
|
|
|
|
|
or Hydrogen::croak( |
442
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_shallow_clone: got %d, %s", |
443
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
444
|
|
|
|
|
|
|
); |
445
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
446
|
|
|
|
|
|
|
or Hydrogen::croak( |
447
|
|
|
|
|
|
|
"Type check failed in signature for curry_shallow_clone: %s should be %s", |
448
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
449
|
|
|
|
|
|
|
); |
450
|
1
|
|
|
|
|
2
|
my $ref = \$_[0]; |
451
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::shallow_clone( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=head2 C<< curry_sorted_keys( $hashref ) >> |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::sorted_keys >>. |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=cut |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
sub curry_sorted_keys { |
461
|
1
|
50
|
|
1
|
1
|
3130
|
@_ == 1 |
462
|
|
|
|
|
|
|
or Hydrogen::croak( |
463
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_sorted_keys: got %d, %s", |
464
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
465
|
|
|
|
|
|
|
); |
466
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
467
|
|
|
|
|
|
|
or Hydrogen::croak( |
468
|
|
|
|
|
|
|
"Type check failed in signature for curry_sorted_keys: %s should be %s", |
469
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
470
|
|
|
|
|
|
|
); |
471
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
472
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::HashRef::sorted_keys( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=head2 C<< curry_values( $hashref ) >> |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::HashRef::values >>. |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=cut |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
sub curry_values { |
482
|
1
|
50
|
|
1
|
1
|
2799
|
@_ == 1 |
483
|
|
|
|
|
|
|
or Hydrogen::croak( |
484
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_values: got %d, %s", |
485
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
486
|
|
|
|
|
|
|
); |
487
|
1
|
50
|
|
|
|
5
|
(ref($_[0]) eq 'HASH') |
488
|
|
|
|
|
|
|
or Hydrogen::croak( |
489
|
|
|
|
|
|
|
"Type check failed in signature for curry_values: %s should be %s", |
490
|
|
|
|
|
|
|
"\\$_[0]", "HashRef" |
491
|
|
|
|
|
|
|
); |
492
|
1
|
|
|
|
|
2
|
my $ref = \$_[0]; |
493
|
1
|
|
|
0
|
|
4
|
return sub { Hydrogen::HashRef::values( $$ref, @_ ) }; |
|
0
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
} |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
1; |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=head1 EXPORT |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
No functions are exported by this module by default. To import them all (this is usually a bad idea), use: |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
use Hydrogen::Curry::HashRef -all; |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
To import a particular function, use: |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
use Hydrogen::Curry::HashRef 'curry_clear'; |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
To rename functions: |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
use Hydrogen::Curry::HashRef 'curry_clear' => { -as => 'myfunc' }; |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
On Perl 5.37.2+, you can import lexically: |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
use Hydrogen::Curry::HashRef -lexical, 'curry_clear'; |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
See L for more hints on importing. |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=head1 BUGS |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
Please report any bugs to |
521
|
|
|
|
|
|
|
L. |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=head1 SEE ALSO |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
L, |
526
|
|
|
|
|
|
|
L, |
527
|
|
|
|
|
|
|
L, |
528
|
|
|
|
|
|
|
L, |
529
|
|
|
|
|
|
|
L, |
530
|
|
|
|
|
|
|
L. |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=head1 AUTHOR |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
Toby Inkster Etobyink@cpan.orgE. |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Toby Inkster. |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
541
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
546
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
547
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
548
|
|
|
|
|
|
|
|