... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
0.1638 |
2 |
+ added experimental base_table attribute and removed experimental table_class attribute |
|
2 | 3 |
renamed helper to method. helper is available, but deprecated. |
3 | 4 |
added experimental DBIx::Custom::Result::stash() |
4 |
- added experimental base_table attribute and removed experimental table_class attribute |
|
5 | 5 |
renamed experimental DBIx::Custom::Table helper to method |
6 | 6 |
0.1637 |
7 | 7 |
renamed dbi_options to dbi_option. dbi_options is available, but deprecated. |
... | ... |
@@ -7,7 +7,10 @@ use base 'Object::Simple'; |
7 | 7 |
|
8 | 8 |
use Carp 'croak'; |
9 | 9 |
|
10 |
-__PACKAGE__->attr([qw/filters sth/]); |
|
10 |
+__PACKAGE__->attr( |
|
11 |
+ [qw/filters sth/], |
|
12 |
+ stash => sub { {} } |
|
13 |
+); |
|
11 | 14 |
|
12 | 15 |
sub filter { |
13 | 16 |
my $self = shift; |
... | ... |
@@ -328,8 +331,8 @@ and implements the following new ones. |
328 | 331 |
|
329 | 332 |
=head2 C<(experimental) end_filter> |
330 | 333 |
|
331 |
- $result = $result->end_filter(title => 'to_upper_case', |
|
332 |
- author => 'to_upper_case'); |
|
334 |
+ $result = $result->end_filter(title => 'to_something', |
|
335 |
+ author => 'to_something'); |
|
333 | 336 |
|
334 | 337 |
End filters. |
335 | 338 |
These each filters is executed after the filters applied by C<apply_filter> of |
... | ... |
@@ -387,11 +390,19 @@ Row count must be specified. |
387 | 390 |
|
388 | 391 |
=head2 C<filter> |
389 | 392 |
|
390 |
- $result = $result->filter(title => 'to_upper_case', |
|
391 |
- author => 'to_upper_case'); |
|
393 |
+ $result = $result->filter(title => 'to_something', |
|
394 |
+ author => 'to_something'); |
|
392 | 395 |
|
393 | 396 |
Filters. |
394 | 397 |
These each filters override the filters applied by C<apply_filter> of |
395 | 398 |
L<DBIx::Custom>. |
396 | 399 |
|
400 |
+=head2 C<(experimental) stash> |
|
401 |
+ |
|
402 |
+ my $stash = $result->stash; |
|
403 |
+ my $foo = $result->stash->{foo}; |
|
404 |
+ $result->stash->{foo} = $foo; |
|
405 |
+ |
|
406 |
+Stash is hash reference to save your data. |
|
407 |
+ |
|
397 | 408 |
=cut |
... | ... |
@@ -1067,3 +1067,8 @@ $dbi = DBIx::Custom->connect(data_source => 'dbi:SQLite:dbname=:memory:', |
1067 | 1067 |
dbi_options => {PrintError => 1}); |
1068 | 1068 |
ok($dbi->dbh->{PrintError}); |
1069 | 1069 |
|
1070 |
+test 'DBIx::Custom::Result stash()'; |
|
1071 |
+$result = DBIx::Custom::Result->new; |
|
1072 |
+is_deeply($result->stash, {}, 'default'); |
|
1073 |
+$result->stash->{foo} = 1; |
|
1074 |
+is($result->stash->{foo}, 1, 'get and set'); |