Skip to content

Instantly share code, notes, and snippets.

@moltar
Last active December 12, 2015 00:28
Show Gist options
  • Save moltar/4683789 to your computer and use it in GitHub Desktop.
Save moltar/4683789 to your computer and use it in GitHub Desktop.
dbic stash example
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