1DBIx::Class::Candy::ResUusletrSeCto(n3t)ributed Perl DocDuBmIexn:t:aCtliaosns::Candy::ResultSet(3)
2
3
4

NAME

6       DBIx::Class::Candy::ResultSet - Sugar for your resultsets
7

SYNOPSIS

9        package MyApp::Schema::ResultSet::Artist;
10
11        use DBIx::Class::Candy::ResultSet
12          -components => ['Helper::ResultSet::Me'];
13
14        use experimental 'signatures';
15
16        sub by_name ($self, $name) { $self->search({ $self->me . 'name' => $name }) }
17
18        1;
19

DESCRIPTION

21       "DBIx::Class::Candy::ResultSet" is an initial sugar layer in the spirit
22       of DBIx::Class::Candy.  Unlike the original it does not define a DSL,
23       though I do have plans for that in the future.  For now all it does is
24       set some imports:
25
26       ·   turns on strict and warnings
27
28       ·   sets your parent class
29
30       ·   sets your mro to "c3"
31

IMPORT OPTIONS

33       See "SETTING DEFAULT IMPORT OPTIONS" for information on setting these
34       schema wide.
35
36   -base
37        use DBIx::Class::Candy::ResultSet -base => 'MyApp::Schema::ResultSet';
38
39       The first thing you can do to customize your usage of
40       "DBIx::Class::Candy::ResultSet" is change the parent class.  Do that by
41       using the "-base" import option.
42
43   -components
44        use DBIx::Class::Candy::ResultSet -components => ['Helper::ResultSet::Me'];
45
46       "DBIx::Class::Candy::ResultSet" allows you to set which components you
47       are using at import time.
48
49   -perl5
50        use DBIx::Class::Candy::ResultSet -perl5 => v20;
51
52       I love the new features in Perl 5.20, so I felt that it would be nice
53       to remove the boiler plate of doing "use feature ':5.20'" and add it to
54       my sugar importer.  Feel free not to use this.
55

SETTING DEFAULT IMPORT OPTIONS

57       Eventually you will get tired of writing the following in every single
58       one of your resultsets:
59
60        use DBIx::Class::Candy::ResultSet
61          -base      => 'MyApp::Schema::ResultSet',
62          -perl5     => v20,
63          -experimental => ['signatures'];
64
65       You can set all of these for your whole schema if you define your own
66       "Candy::ResultSet" subclass as follows:
67
68        package MyApp::Schema::Candy::ResultSet;
69
70        use base 'DBIx::Class::Candy::ResultSet';
71
72        sub base { $_[1] || 'MyApp::Schema::ResultSEt' }
73        sub perl_version { 20 }
74        sub experimental { ['signatures'] }
75
76       Note the "$_[1] ||" in "base".  All of these methods are passed the
77       values passed in from the arguments to the subclass, so you can either
78       throw them away, honor them, die on usage, or whatever.  To be clear,
79       if you define your subclass, and someone uses it as follows:
80
81        use MyApp::Schema::Candy::ResultSet
82           -base => 'MyApp::Schema::ResultSet',
83           -perl5 => v18,
84          -experimental => ['postderef'];
85
86       Your "base" method will get "MyApp::Schema::ResultSet", your
87       "experimental" will get "['postderef']", and your "perl_version" will
88       get 18.
89

AUTHOR

91       Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
92
94       This software is copyright (c) 2017 by Arthur Axel "fREW" Schmidt.
95
96       This is free software; you can redistribute it and/or modify it under
97       the same terms as the Perl 5 programming language system itself.
98
99
100
101perl v5.30.1                      2020-01-29  DBIx::Class::Candy::ResultSet(3)
Impressum