NAME DBIx::Class::Schema::ResultSetNames - Add singluar and plural resultset accessors from schema class names VERSION Version 1.0. SYNOPSIS # in MyApp::Schema __PACKAGE__->load_components('Schema::ResultSetNames'); DESCRIPTION DBIx::Class::Schema::ResultSetNames adds both singular and plural method accessors for all resultsets. So, instead of this: my $schema = MyApp::Schema->connect(...); my $result = $schema->resultset('Author')->search({...}); you may choose to this: my $schema = MyApp::Schema->connect(...); my $result = $schema->authors->search({...}); And instead of this: my $schema = MyApp::Schema->connect(...); my $result = $schema->resultset('Author')->find($id); you may choose to this: my $schema = MyApp::Schema->connect(...); my $result = $schema->author($id) What is returned? If you call the plural form of the resultset (e.g. `authors`), you will get a DBIx::Class::ResultSet, which may be empty, if no rows satisfy whatever criteria you've chained behind it. For the singular form (`author`), you'll get a DBIx::Class::Row, or `undef`, if the selected row does not exist. A note about `find`. It is perfectly permissible to use find (or the singular accessor, in this module) to locate something by including a hashref of search terms: my $result = $schema->resultSet('Author')->find({ name => 'John Smith }); # Old way my $result = $schema->author({ name => 'John Smith' }); # New way However, be aware that `find()` and this module will both complain if your request will return multiple rows, and throw a warning. `find()` expects to return one row or undef, which is why it is best used on unique keys. "Let not your heart be troubled..." about relationships. This doesn't tamper with relationship accessors in any way. If you have a table of Authors and a table of Books, the usual sort of `book($id)->author()`, and `author($id)->books()` relationship tools will still work just fine. SEE ALSO * DBIx::Class::ResultSet * DBIx::Class::Row CREDIT WHERE CREDIT IS DUE Practically all of this code is the work of Matt S Trout (mst) . It was created alongside a Dancer2 plugin that he has helped greatly with. I just tidied things up and wrote documentation. SOURCE https://gitlab.com/geekruthie/DBIx-Class-Schema-ResultSetNames HOMEPAGE https://metacpan.org/release/DBIx-Class-Schema-ResultSetNames AUTHOR D Ruth Holloway COPYRIGHT AND LICENSE This software is copyright (c) 2021 by D Ruth Holloway. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.