packaging one directory
|
1 |
package DBIx::Custom::Result; |
updatedd pod
|
2 |
use Object::Simple -base; |
cleanup
|
3 | |
packaging one directory
|
4 |
use Carp 'croak'; |
cleanup
|
5 |
use DBIx::Custom::Util qw/_array_to_hash _subname/; |
packaging one directory
|
6 | |
- changed EXPERIMENTAL DBIx:...
|
7 |
has [qw/filters sth/], |
8 |
stash => sub { {} }; |
|
cleanup
|
9 | |
- added DBIx::Custom::Result...
|
10 |
*all = \&fetch_hash_all; |
11 | ||
cleanup
|
12 |
sub filter { |
13 |
my $self = shift; |
|
cleanup
|
14 |
|
cleanup
|
15 |
# Set |
cleanup
|
16 |
if (@_) { |
17 |
|
|
cleanup
|
18 |
# Convert filter name to subroutine |
19 |
my $filter = @_ == 1 ? $_[0] : [@_]; |
|
20 |
$filter = _array_to_hash($filter); |
|
cleanup
|
21 |
foreach my $column (keys %$filter) { |
22 |
my $fname = $filter->{$column}; |
|
fix bug : filter can't over...
|
23 |
if (exists $filter->{$column} |
24 |
&& defined $fname |
|
25 |
&& ref $fname ne 'CODE') |
|
26 |
{ |
|
cleanup
|
27 |
croak qq{Filter "$fname" is not registered" } . _subname |
cleanup
|
28 |
unless exists $self->filters->{$fname}; |
29 |
$filter->{$column} = $self->filters->{$fname}; |
|
30 |
} |
|
cleanup
|
31 |
} |
cleanup
|
32 |
|
cleanup
|
33 |
# Merge |
added experimental DBIx::Cus...
|
34 |
$self->{filter} = {%{$self->filter}, %$filter}; |
cleanup
|
35 |
|
36 |
return $self; |
|
cleanup
|
37 |
} |
38 |
|
|
added experimental DBIx::Cus...
|
39 |
return $self->{filter} ||= {}; |
40 |
} |
|
41 | ||
- changed EXPERIMENTAL DBIx:...
|
42 |
sub filter_off { |
43 |
my $self = shift; |
|
44 |
$self->{filter_off} = 1; |
|
45 |
return $self; |
|
46 |
} |
|
47 | ||
48 |
sub filter_on { |
|
49 |
my $self = shift; |
|
50 |
$self->{filter_off} = 0; |
|
51 |
return $self; |
|
52 |
} |
|
53 | ||
packaging one directory
|
54 |
sub fetch { |
changed argument of tag proc...
|
55 |
my $self = shift; |
56 |
|
|
added EXPERIMENTAL DBIx::Cus...
|
57 |
# Info |
58 |
my $columns = $self->{sth}->{NAME}; |
|
59 |
my $types = $self->{sth}->{TYPE}; |
|
60 |
|
|
packaging one directory
|
61 |
# Fetch |
changed argument of tag proc...
|
62 |
my @row = $self->{sth}->fetchrow_array; |
update document
|
63 |
return unless @row; |
added check_filter attribute
|
64 |
|
cleanup
|
65 |
# Filtering |
EXPERIMENTAL type_rule argum...
|
66 |
my $type_rule1 = $self->type_rule->{from1} || {}; |
67 |
my $type_rule2 = $self->type_rule->{from2} || {}; |
|
separate DBIx::Custom::Resul...
|
68 |
my $filter = $self->filter; |
fixed end_filter DEPRECATED ...
|
69 |
my $end_filter = $self->{end_filter} || {}; |
cleanup
|
70 |
for (my $i = 0; $i < @$columns; $i++) { |
added type_rule method and f...
|
71 |
|
separate DBIx::Custom::Resul...
|
72 |
# Column |
cleanup
|
73 |
my $column = $columns->[$i]; |
some changed
|
74 |
|
separate DBIx::Custom::Resul...
|
75 |
# Type rule |
EXPERIMENTAL type_rule argum...
|
76 |
my $type_filter1 = $type_rule1->{lc($types->[$i])}; |
77 |
$row[$i] = $type_filter1->($row[$i]) |
|
78 |
if $type_filter1 && !$self->{type_rule_off} |
|
79 |
&& !$self->{type_rule1_off}; |
|
80 |
my $type_filter2 = $type_rule2->{lc($types->[$i])}; |
|
81 |
$row[$i] = $type_filter2->($row[$i]) |
|
82 |
if $type_filter2 && !$self->{type_rule_off} |
|
83 |
&& !$self->{type_rule2_off}; |
|
separate DBIx::Custom::Resul...
|
84 |
|
85 |
# Filter |
|
86 |
my $filter = $filter->{$column} || $self->{default_filter}; |
|
87 |
$row[$i] = $filter->($row[$i]) |
|
88 |
if $filter && !$self->{filter_off}; |
|
89 |
$row[$i] = $end_filter->{$column}->($row[$i]) |
|
90 |
if $end_filter->{$column} && !$self->{filter_off}; |
|
packaging one directory
|
91 |
} |
many many changes
|
92 | |
removed reconnect method
|
93 |
return \@row; |
94 |
} |
|
95 | ||
cleanup
|
96 |
sub fetch_all { |
97 |
my $self = shift; |
|
98 |
|
|
99 |
# Fetch all rows |
|
100 |
my $rows = []; |
|
cleanup
|
101 |
while(my $row = $self->fetch) { push @$rows, $row} |
102 |
|
|
cleanup
|
103 |
return $rows; |
104 |
} |
|
105 | ||
removed reconnect method
|
106 |
sub fetch_first { |
107 |
my $self = shift; |
|
108 |
|
|
109 |
# Fetch |
|
110 |
my $row = $self->fetch; |
|
111 |
return unless $row; |
|
112 |
|
|
113 |
# Finish statement handle |
|
114 |
$self->sth->finish; |
|
115 |
|
|
116 |
return $row; |
|
117 |
} |
|
118 | ||
packaging one directory
|
119 |
sub fetch_hash { |
changed argument of tag proc...
|
120 |
my $self = shift; |
121 |
|
|
added EXPERIMENTAL DBIx::Cus...
|
122 |
# Info |
123 |
my $columns = $self->{sth}->{NAME}; |
|
124 |
my $types = $self->{sth}->{TYPE}; |
|
125 |
|
|
packaging one directory
|
126 |
# Fetch |
changed argument of tag proc...
|
127 |
my $row = $self->{sth}->fetchrow_arrayref; |
packaging one directory
|
128 |
return unless $row; |
added check_filter attribute
|
129 | |
packaging one directory
|
130 |
# Filter |
separate DBIx::Custom::Resul...
|
131 |
my $hash_row = {}; |
132 |
my $filter = $self->filter; |
|
fixed end_filter DEPRECATED ...
|
133 |
my $end_filter = $self->{end_filter} || {}; |
EXPERIMENTAL type_rule argum...
|
134 |
my $type_rule1 = $self->type_rule->{from1} || {}; |
135 |
my $type_rule2 = $self->type_rule->{from2} || {}; |
|
cleanup
|
136 |
for (my $i = 0; $i < @$columns; $i++) { |
update document
|
137 |
|
separate DBIx::Custom::Resul...
|
138 |
# Column |
cleanup
|
139 |
my $column = $columns->[$i]; |
EXPERIMENTAL type_rule argum...
|
140 |
$hash_row->{$column} = $row->[$i]; |
add query filter error check
|
141 |
|
separate DBIx::Custom::Resul...
|
142 |
# Type rule |
EXPERIMENTAL type_rule argum...
|
143 |
my $type_filter1 = $type_rule1->{lc($types->[$i])}; |
144 |
$hash_row->{$column} = $type_filter1->($hash_row->{$column}) |
|
145 |
if !$self->{type_rule_off} && !$self->{type_rule1_off} |
|
146 |
&& $type_filter1; |
|
147 |
my $type_filter2 = $type_rule2->{lc($types->[$i])}; |
|
148 |
$hash_row->{$column} = $type_filter2->($hash_row->{$column}) |
|
149 |
if !$self->{type_rule_off} && !$self->{type_rule2_off} |
|
150 |
&& $type_filter2; |
|
separate DBIx::Custom::Resul...
|
151 |
|
152 |
# Filter |
|
153 |
my $f = $filter->{$column} || $self->{default_filter}; |
|
154 |
$hash_row->{$column} = $f->($hash_row->{$column}) |
|
155 |
if $f && !$self->{filter_off}; |
|
156 |
$hash_row->{$column} = $end_filter->{$column}->($hash_row->{$column}) |
|
157 |
if $end_filter->{$column} && !$self->{filter_off}; |
|
packaging one directory
|
158 |
} |
159 |
|
|
separate DBIx::Custom::Resul...
|
160 |
return $hash_row; |
packaging one directory
|
161 |
} |
162 | ||
cleanup
|
163 |
sub fetch_hash_all { |
164 |
my $self = shift; |
|
165 |
|
|
166 |
# Fetch all rows as hash |
|
167 |
my $rows = []; |
|
cleanup
|
168 |
while(my $row = $self->fetch_hash) { push @$rows, $row } |
cleanup
|
169 |
|
170 |
return $rows; |
|
171 |
} |
|
172 | ||
removed reconnect method
|
173 |
sub fetch_hash_first { |
packaging one directory
|
174 |
my $self = shift; |
175 |
|
|
176 |
# Fetch hash |
|
177 |
my $row = $self->fetch_hash; |
|
178 |
return unless $row; |
|
179 |
|
|
180 |
# Finish statement handle |
|
some changed
|
181 |
$self->sth->finish; |
packaging one directory
|
182 |
|
removed reconnect method
|
183 |
return $row; |
packaging one directory
|
184 |
} |
185 | ||
renamed fetch_rows to fetch_...
|
186 |
sub fetch_hash_multi { |
packaging one directory
|
187 |
my ($self, $count) = @_; |
188 |
|
|
cleanup
|
189 |
# Fetch multiple rows |
cleanup
|
190 |
croak 'Row count must be specified ' . _subname |
packaging one directory
|
191 |
unless $count; |
192 |
my $rows = []; |
|
193 |
for (my $i = 0; $i < $count; $i++) { |
|
removed reconnect method
|
194 |
my $row = $self->fetch_hash; |
195 |
last unless $row; |
|
196 |
push @$rows, $row; |
|
packaging one directory
|
197 |
} |
198 |
|
|
199 |
return unless @$rows; |
|
removed reconnect method
|
200 |
return $rows; |
packaging one directory
|
201 |
} |
202 | ||
cleanup
|
203 |
sub fetch_multi { |
204 |
my ($self, $count) = @_; |
|
packaging one directory
|
205 |
|
cleanup
|
206 |
# Row count not specifed |
cleanup
|
207 |
croak 'Row count must be specified ' . _subname |
cleanup
|
208 |
unless $count; |
209 |
|
|
210 |
# Fetch multi rows |
|
packaging one directory
|
211 |
my $rows = []; |
cleanup
|
212 |
for (my $i = 0; $i < $count; $i++) { |
213 |
my $row = $self->fetch; |
|
214 |
last unless $row; |
|
removed reconnect method
|
215 |
push @$rows, $row; |
packaging one directory
|
216 |
} |
changed argument of tag proc...
|
217 |
|
cleanup
|
218 |
return unless @$rows; |
removed reconnect method
|
219 |
return $rows; |
packaging one directory
|
220 |
} |
221 | ||
added EXPERIMENTAL DBIx::Cus...
|
222 |
sub header { shift->sth->{NAME} } |
223 | ||
- added DBIx::Custom::Result...
|
224 |
*one = \&fetch_hash_first; |
225 | ||
added EXPERIMENTAL DBIx::Cus...
|
226 |
sub type_rule { |
227 |
my $self = shift; |
|
228 |
|
|
229 |
if (@_) { |
|
EXPERIMENTAL type_rule argum...
|
230 |
my $type_rule = ref $_[0] eq 'HASH' ? $_[0] : {@_}; |
231 | ||
232 |
# From |
|
233 |
foreach my $i (1 .. 2) { |
|
234 |
$type_rule->{"from$i"} = _array_to_hash($type_rule->{"from$i"}); |
|
235 |
foreach my $data_type (keys %{$type_rule->{"from$i"} || {}}) { |
|
236 |
croak qq{data type of from$i section must be lower case or number} |
|
237 |
if $data_type =~ /[A-Z]/; |
|
238 |
my $fname = $type_rule->{"from$i"}{$data_type}; |
|
239 |
if (defined $fname && ref $fname ne 'CODE') { |
|
240 |
croak qq{Filter "$fname" is not registered" } . _subname |
|
241 |
unless exists $self->filters->{$fname}; |
|
242 |
|
|
243 |
$type_rule->{"from$i"}{$data_type} = $self->filters->{$fname}; |
|
244 |
} |
|
added EXPERIMENTAL DBIx::Cus...
|
245 |
} |
246 |
} |
|
EXPERIMENTAL type_rule argum...
|
247 |
$self->{type_rule} = $type_rule; |
DBIx::Custom::Result type_ru...
|
248 |
|
249 |
return $self; |
|
added EXPERIMENTAL DBIx::Cus...
|
250 |
} |
251 |
|
|
EXPERIMENTAL type_rule argum...
|
252 |
return $self->{type_rule} || {}; |
added EXPERIMENTAL DBIx::Cus...
|
253 |
} |
254 | ||
- changed EXPERIMENTAL DBIx:...
|
255 |
sub type_rule_off { |
256 |
my $self = shift; |
|
257 |
$self->{type_rule_off} = 1; |
|
258 |
return $self; |
|
259 |
} |
|
260 | ||
261 |
sub type_rule_on { |
|
262 |
my $self = shift; |
|
263 |
$self->{type_rule_off} = 0; |
|
264 |
return $self; |
|
265 |
} |
|
266 | ||
267 |
sub type_rule1_off { |
|
268 |
my $self = shift; |
|
269 |
$self->{type_rule1_off} = 1; |
|
270 |
return $self; |
|
271 |
} |
|
272 | ||
273 |
sub type_rule1_on { |
|
274 |
my $self = shift; |
|
275 |
$self->{type_rule1_off} = 0; |
|
276 |
return $self; |
|
277 |
} |
|
278 | ||
279 |
sub type_rule2_off { |
|
280 |
my $self = shift; |
|
281 |
$self->{type_rule2_off} = 1; |
|
282 |
return $self; |
|
283 |
} |
|
284 | ||
285 |
sub type_rule2_on { |
|
286 |
my $self = shift; |
|
287 |
$self->{type_rule2_off} = 0; |
|
288 |
return $self; |
|
289 |
} |
|
290 | ||
cleanup
|
291 |
# DEPRECATED! |
292 |
sub end_filter { |
|
- added EXPERIMENTAL order m...
|
293 |
warn "end_filter method is DEPRECATED!"; |
cleanup
|
294 |
my $self = shift; |
295 |
if (@_) { |
|
296 |
my $end_filter = {}; |
|
cleanup
|
297 |
if (ref $_[0] eq 'HASH') { $end_filter = $_[0] } |
298 |
else { |
|
cleanup
|
299 |
$end_filter = _array_to_hash( |
300 |
@_ > 1 ? [@_] : $_[0] |
|
301 |
); |
|
302 |
} |
|
303 |
foreach my $column (keys %$end_filter) { |
|
304 |
my $fname = $end_filter->{$column}; |
|
305 |
if (exists $end_filter->{$column} |
|
306 |
&& defined $fname |
|
307 |
&& ref $fname ne 'CODE') |
|
308 |
{ |
|
309 |
croak qq{Filter "$fname" is not registered" } . _subname |
|
310 |
unless exists $self->filters->{$fname}; |
|
311 |
$end_filter->{$column} = $self->filters->{$fname}; |
|
312 |
} |
|
313 |
} |
|
314 |
$self->{end_filter} = {%{$self->end_filter}, %$end_filter}; |
|
315 |
return $self; |
|
316 |
} |
|
317 |
return $self->{end_filter} ||= {}; |
|
318 |
} |
|
cleanup
|
319 |
# DEPRECATED! |
added experimental DBIx::Cus...
|
320 |
sub remove_end_filter { |
- added EXPERIMENTAL order m...
|
321 |
warn "remove_end_filter is DEPRECATED!"; |
added experimental DBIx::Cus...
|
322 |
my $self = shift; |
323 |
$self->{end_filter} = {}; |
|
324 |
return $self; |
|
325 |
} |
|
cleanup
|
326 |
# DEPRECATED! |
added experimental DBIx::Cus...
|
327 |
sub remove_filter { |
- added EXPERIMENTAL order m...
|
328 |
warn "remove_filter is DEPRECATED!"; |
added experimental DBIx::Cus...
|
329 |
my $self = shift; |
330 |
$self->{filter} = {}; |
|
331 |
return $self; |
|
332 |
} |
|
cleanup
|
333 |
# DEPRECATED! |
cleanup
|
334 |
sub default_filter { |
cleanup
|
335 |
warn "default_filter is DEPRECATED!"; |
- added EXPERIMENTAL order m...
|
336 |
my $self = shift; |
cleanup
|
337 |
if (@_) { |
338 |
my $fname = $_[0]; |
|
339 |
if (@_ && !$fname) { |
|
340 |
$self->{default_filter} = undef; |
|
341 |
} |
|
342 |
else { |
|
many changed
|
343 |
croak qq{Filter "$fname" is not registered} |
cleanup
|
344 |
unless exists $self->filters->{$fname}; |
345 |
$self->{default_filter} = $self->filters->{$fname}; |
|
346 |
} |
|
347 |
return $self; |
|
348 |
} |
|
349 |
return $self->{default_filter}; |
|
350 |
} |
|
cleanup
|
351 |
# DEPRECATED! |
cleanup
|
352 |
has 'filter_check'; |
cleanup
|
353 | |
update document
|
354 |
1; |
355 | ||
packaging one directory
|
356 |
=head1 NAME |
357 | ||
cleanup
|
358 |
DBIx::Custom::Result - Result of select statement |
packaging one directory
|
359 | |
update document
|
360 |
=head1 SYNOPSIS |
cleanup
|
361 | |
removed reconnect method
|
362 |
# Result |
cleanup
|
363 |
my $result = $dbi->select(table => 'book'); |
cleanup
|
364 | |
cleanup
|
365 |
# Fetch a row and put it into array reference |
removed reconnect method
|
366 |
while (my $row = $result->fetch) { |
cleanup
|
367 |
my $author = $row->[0]; |
368 |
my $title = $row->[1]; |
|
version 0.0901
|
369 |
} |
370 |
|
|
cleanup
|
371 |
# Fetch only a first row and put it into array reference |
removed reconnect method
|
372 |
my $row = $result->fetch_first; |
373 |
|
|
cleanup
|
374 |
# Fetch all rows and put them into array of array reference |
removed reconnect method
|
375 |
my $rows = $result->fetch_all; |
cleanup
|
376 | |
cleanup
|
377 |
# Fetch a row and put it into hash reference |
removed reconnect method
|
378 |
while (my $row = $result->fetch_hash) { |
cleanup
|
379 |
my $title = $row->{title}; |
380 |
my $author = $row->{author}; |
|
packaging one directory
|
381 |
} |
removed reconnect method
|
382 |
|
cleanup
|
383 |
# Fetch only a first row and put it into hash reference |
removed reconnect method
|
384 |
my $row = $result->fetch_hash_first; |
cleanup
|
385 |
my $row = $result->one; # Same as fetch_hash_first |
removed reconnect method
|
386 |
|
cleanup
|
387 |
# Fetch all rows and put them into array of hash reference |
removed reconnect method
|
388 |
my $rows = $result->fetch_hash_all; |
cleanup
|
389 |
my $rows = $result->all; # Same as fetch_hash_all |
packaging one directory
|
390 | |
update document
|
391 |
=head1 ATTRIBUTES |
packaging one directory
|
392 | |
cleanup
|
393 |
=head2 C<filters> |
394 | ||
395 |
my $filters = $result->filters; |
|
cleanup
|
396 |
$result = $result->filters(\%filters); |
cleanup
|
397 | |
cleanup
|
398 |
Filters. |
cleanup
|
399 | |
400 |
=head2 C<sth> |
|
401 | ||
402 |
my $sth = $reuslt->sth |
|
403 |
$result = $result->sth($sth); |
|
404 | ||
405 |
Statement handle of L<DBI>. |
|
406 | ||
update document
|
407 |
=head1 METHODS |
408 | ||
renamed build_query to creat...
|
409 |
L<DBIx::Custom::Result> inherits all methods from L<Object::Simple> |
cleanup
|
410 |
and implements the following new ones. |
packaging one directory
|
411 | |
updated pod
|
412 |
=head2 C<all> |
413 | ||
414 |
my $rows = $result->all; |
|
415 | ||
cleanup
|
416 |
Same as C<fetch_hash_all>. |
updated pod
|
417 | |
removed DBIx::Custom commit ...
|
418 |
=head2 C<fetch> |
packaging one directory
|
419 | |
cleanup
|
420 |
my $row = $result->fetch; |
version 0.0901
|
421 | |
cleanup
|
422 |
Fetch a row and put it into array reference. |
packaging one directory
|
423 | |
removed DBIx::Custom commit ...
|
424 |
=head2 C<fetch_all> |
packaging one directory
|
425 | |
cleanup
|
426 |
my $rows = $result->fetch_all; |
version 0.0901
|
427 | |
cleanup
|
428 |
Fetch all rows and put them into array of array reference. |
packaging one directory
|
429 | |
cleanup
|
430 |
=head2 C<fetch_first> |
431 | ||
432 |
my $row = $result->fetch_first; |
|
433 | ||
cleanup
|
434 |
Fetch only a first row and put it into array reference, |
435 |
and finish statment handle. |
|
cleanup
|
436 | |
removed DESTROY method(not b...
|
437 |
=head2 C<fetch_hash> |
packaging one directory
|
438 | |
cleanup
|
439 |
my $row = $result->fetch_hash; |
packaging one directory
|
440 | |
cleanup
|
441 |
Fetch a row and put it into hash reference. |
update document
|
442 | |
cleanup
|
443 |
=head2 C<fetch_hash_all> |
444 | ||
445 |
my $rows = $result->fetch_hash_all; |
|
446 | ||
cleanup
|
447 |
Fetch all rows and put them into array of hash reference. |
cleanup
|
448 | |
removed DBIx::Custom commit ...
|
449 |
=head2 C<fetch_hash_first> |
removed reconnect method
|
450 |
|
cleanup
|
451 |
my $row = $result->fetch_hash_first; |
packaging one directory
|
452 | |
cleanup
|
453 |
Fetch only a first row and put it into hash reference, |
454 |
and finish statment handle. |
|
packaging one directory
|
455 | |
removed DESTROY method(not b...
|
456 |
=head2 C<fetch_hash_multi> |
update document
|
457 | |
cleanup
|
458 |
my $rows = $result->fetch_hash_multi(5); |
update document
|
459 |
|
cleanup
|
460 |
Fetch multiple rows and put them into array of hash reference. |
update document
|
461 | |
cleanup
|
462 |
=head2 C<fetch_multi> |
packaging one directory
|
463 | |
cleanup
|
464 |
my $rows = $result->fetch_multi(5); |
465 |
|
|
cleanup
|
466 |
Fetch multiple rows and put them into array of array reference. |
removed DESTROY method(not b...
|
467 | |
cleanup
|
468 |
=head2 C<filter> |
469 | ||
cleanup
|
470 |
$result->filter(title => sub { uc $_[0] }, author => 'to_upper'); |
471 |
$result->filter([qw/title author/] => 'to_upper'); |
|
added experimental DBIx::Cus...
|
472 | |
cleanup
|
473 |
Set filter for column. |
474 |
You can use subroutine or filter name as filter. |
|
- DBIx::Custom Model filter ...
|
475 |
This filter is executed after C<type_rule> filter. |
cleanup
|
476 | |
- changed EXPERIMENTAL DBIx:...
|
477 |
=head2 C<filter_off> EXPERIMENTAL |
478 | ||
479 |
$result = $result->filter_off; |
|
480 | ||
481 |
Turn filtering by C<filter> method off. |
|
482 |
By default, filterin is on. |
|
483 | ||
484 |
=head2 C<filter_on> EXPERIMENTAL |
|
485 | ||
486 |
$result = $resutl->filter_on; |
|
487 | ||
488 |
Turn filtering by C<filter> method on. |
|
489 |
By default, filterin is on. |
|
490 | ||
- removed EXPERIMENTAL statu...
|
491 |
=head2 C<header> |
added EXPERIMENTAL DBIx::Cus...
|
492 | |
493 |
my $header = $result->header; |
|
494 | ||
495 |
Get header column names. |
|
496 | ||
updated pod
|
497 |
=head2 C<one> |
498 | ||
499 |
my $row = $result->one; |
|
500 | ||
cleanup
|
501 |
Same as C<fetch_hash_first>. |
added experimental DBIx::Cus...
|
502 | |
- removed DEPRECATED DBIx::C...
|
503 |
=head2 C<stash> |
added experimental DBIx::Cus...
|
504 | |
505 |
my $stash = $result->stash; |
|
506 |
my $foo = $result->stash->{foo}; |
|
507 |
$result->stash->{foo} = $foo; |
|
508 | ||
cleanup
|
509 |
Stash is hash reference for data. |
added experimental DBIx::Cus...
|
510 | |
added EXPERIMENTAL DBIx::Cus...
|
511 |
=head2 C<type_rule> EXPERIMENTAL |
cleanup
|
512 |
|
513 |
# Merge type rule |
|
added EXPERIMENTAL DBIx::Cus...
|
514 |
$result->type_rule( |
515 |
# DATE |
|
516 |
9 => sub { ... }, |
|
517 |
# DATETIME or TIMESTAMP |
|
518 |
11 => sub { ... } |
|
519 |
); |
|
520 | ||
cleanup
|
521 |
# Replace type rule(by reference) |
522 |
$result->type_rule([ |
|
523 |
# DATE |
|
524 |
9 => sub { ... }, |
|
525 |
# DATETIME or TIMESTAMP |
|
526 |
11 => sub { ... } |
|
527 |
]); |
|
EXPERIMENTAL type_rule_off i...
|
528 | |
cleanup
|
529 |
This is same as L<DBIx::Custom>'s C<type_rule>'s <from>. |
EXPERIMENTAL type_rule_off i...
|
530 | |
- changed EXPERIMENTAL DBIx:...
|
531 |
=head2 C<type_rule_off> EXPERIMENTAL |
532 | ||
533 |
$result = $result->type_rule_off; |
|
534 | ||
535 |
Turn C<from1> and C<from2> type rule off. |
|
536 |
By default, type rule is on. |
|
537 | ||
538 |
=head2 C<type_rule_on> EXPERIMENTAL |
|
539 | ||
540 |
$result = $result->type_rule_on; |
|
541 | ||
542 |
Turn C<from1> and C<from2> type rule on. |
|
543 |
By default, type rule is on. |
|
544 | ||
545 |
=head2 C<type_rule1_off> EXPERIMENTAL |
|
546 | ||
547 |
$result = $result->type_rule1_off; |
|
548 | ||
549 |
Turn C<from1> type rule off. |
|
550 |
By default, type rule is on. |
|
551 | ||
552 |
=head2 C<type_rule1_on> EXPERIMENTAL |
|
553 | ||
554 |
$result = $result->type_rule1_on; |
|
555 | ||
556 |
Turn C<from1> type rule on. |
|
557 |
By default, type rule is on. |
|
558 | ||
559 |
=head2 C<type_rule2_off> EXPERIMENTAL |
|
560 | ||
561 |
$result = $result->type_rule2_off; |
|
562 | ||
563 |
Turn C<from2> type rule off. |
|
564 |
By default, type rule is on. |
|
565 | ||
566 |
=head2 C<type_rule2_on> EXPERIMENTAL |
|
567 | ||
568 |
$result = $result->type_rule2_on; |
|
569 | ||
570 |
Turn C<from2> type rule on. |
|
571 |
By default, type rule is on. |
|
572 | ||
packaging one directory
|
573 |
=cut |