DBIx::Class::ResultClass::CallbackInflator - Easier way to make a quick, custom inflator
use DBIx::Class::ResultClass::CallbackInflator; my $result_instance = DBIx::Class::ResultClass::CallbackInflator ->new(callback=>$callback, args=>\@args); my $person_resultset = $schema ->resultset('Person') ->resultclass($result_instance); # Alternatively my $person_resultset = $schema ->resultset('Person') ->search(+{}, +{result_class=>$result_instance});
You might wish to review DBIx::Class::ResultSet::CallbackInflator which is probably the most easy way to actually make use of this in a resultset.
This class defines the following attributes.
This is the callback with receives the row level data for the resultset as it gets it from the database and is responsible for returning a reference to a version of that data suitable for a user.
Arguments passed to the callback.
This component defines the following methods.
Provides the method needed to call table data on your custom callback (with any passed arguments).
John Napiorkowski email:jjnapiork@cpan.org
With thanks to mst for the original code suggestion!
DBIx::Class, DBIx::Class::ResultClass::HashRefInflator.
Copyright 2017, John Napiorkowski email:jjnapiork@cpan.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DBIx::Class::ResultClass::CallbackInflator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::ResultClass::CallbackInflator
CPAN shell
perl -MCPAN -e shell install DBIx::Class::ResultClass::CallbackInflator
For more information on module installation, please visit the detailed CPAN module installation guide.