.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "DBIx::Class::Candy::ResultSet 3pm" .TH DBIx::Class::Candy::ResultSet 3pm "2017-10-29" "perl v5.26.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBIx::Class::Candy::ResultSet \- Sugar for your resultsets .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& package MyApp::Schema::ResultSet::Artist; \& \& use DBIx::Class::Candy::ResultSet \& \-components => [\*(AqHelper::ResultSet::Me\*(Aq]; \& \& use experimental \*(Aqsignatures\*(Aq; \& \& sub by_name ($self, $name) { $self\->search({ $self\->me . \*(Aqname\*(Aq => $name }) } \& \& 1; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`DBIx::Class::Candy::ResultSet\*(C'\fR is an initial sugar layer in the spirit of DBIx::Class::Candy. Unlike the original it does not define a \s-1DSL,\s0 though I do have plans for that in the future. For now all it does is set some imports: .IP "\(bu" 4 turns on strict and warnings .IP "\(bu" 4 sets your parent class .IP "\(bu" 4 sets your mro to \f(CW\*(C`c3\*(C'\fR .SH "IMPORT OPTIONS" .IX Header "IMPORT OPTIONS" See \*(L"\s-1SETTING DEFAULT IMPORT OPTIONS\*(R"\s0 for information on setting these schema wide. .SS "\-base" .IX Subsection "-base" .Vb 1 \& use DBIx::Class::Candy::ResultSet \-base => \*(AqMyApp::Schema::ResultSet\*(Aq; .Ve .PP The first thing you can do to customize your usage of \f(CW\*(C`DBIx::Class::Candy::ResultSet\*(C'\fR is change the parent class. Do that by using the \f(CW\*(C`\-base\*(C'\fR import option. .SS "\-components" .IX Subsection "-components" .Vb 1 \& use DBIx::Class::Candy::ResultSet \-components => [\*(AqHelper::ResultSet::Me\*(Aq]; .Ve .PP \&\f(CW\*(C`DBIx::Class::Candy::ResultSet\*(C'\fR allows you to set which components you are using at import time. .SS "\-perl5" .IX Subsection "-perl5" .Vb 1 \& use DBIx::Class::Candy::ResultSet \-perl5 => v20; .Ve .PP I love the new features in Perl 5.20, so I felt that it would be nice to remove the boiler plate of doing \f(CW\*(C`use feature \*(Aq:5.20\*(Aq\*(C'\fR and add it to my sugar importer. Feel free not to use this. .SH "SETTING DEFAULT IMPORT OPTIONS" .IX Header "SETTING DEFAULT IMPORT OPTIONS" Eventually you will get tired of writing the following in every single one of your resultsets: .PP .Vb 4 \& use DBIx::Class::Candy::ResultSet \& \-base => \*(AqMyApp::Schema::ResultSet\*(Aq, \& \-perl5 => v20, \& \-experimental => [\*(Aqsignatures\*(Aq]; .Ve .PP You can set all of these for your whole schema if you define your own \f(CW\*(C`Candy::ResultSet\*(C'\fR subclass as follows: .PP .Vb 1 \& package MyApp::Schema::Candy::ResultSet; \& \& use base \*(AqDBIx::Class::Candy::ResultSet\*(Aq; \& \& sub base { $_[1] || \*(AqMyApp::Schema::ResultSEt\*(Aq } \& sub perl_version { 20 } \& sub experimental { [\*(Aqsignatures\*(Aq] } .Ve .PP Note the \f(CW\*(C`$_[1] ||\*(C'\fR in \f(CW\*(C`base\*(C'\fR. All of these methods are passed the values passed in from the arguments to the subclass, so you can either throw them away, honor them, die on usage, or whatever. To be clear, if you define your subclass, and someone uses it as follows: .PP .Vb 4 \& use MyApp::Schema::Candy::ResultSet \& \-base => \*(AqMyApp::Schema::ResultSet\*(Aq, \& \-perl5 => v18, \& \-experimental => [\*(Aqpostderef\*(Aq]; .Ve .PP Your \f(CW\*(C`base\*(C'\fR method will get \f(CW\*(C`MyApp::Schema::ResultSet\*(C'\fR, your \f(CW\*(C`experimental\*(C'\fR will get \f(CW\*(C`[\*(Aqpostderef\*(Aq]\*(C'\fR, and your \f(CW\*(C`perl_version\*(C'\fR will get \f(CW18\fR. .SH "AUTHOR" .IX Header "AUTHOR" Arthur Axel \*(L"fREW\*(R" Schmidt .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2017 by Arthur Axel \*(L"fREW\*(R" Schmidt. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.