Last active
December 12, 2015 00:28
-
-
Save moltar/4683789 to your computer and use it in GitHub Desktop.
dbic stash example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package App::Schema::ResultSet; | |
use strict; | |
use warnings; | |
use parent 'DBIx::Class::ResultSet'; | |
__PACKAGE__->mk_group_accessors(inherited => qw/ | |
stash | |
/); | |
__PACKAGE__->stash({}); | |
#--------------------------------------------------------------------------# | |
# search_rs | |
#--------------------------------------------------------------------------# | |
## overload search to pass stash down the chain | |
sub search_rs { | |
my ($self, @params) = @_; | |
my $next = $self->next::method(@params); | |
## pass stash down from original caller to next | |
$next->stash($self->stash); | |
return $next; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment