1DBIx::Class::Helper::ReUssuelrtCCloanstsr:i:bTuetee(d3D)PBeIrxl::DColcausmse:n:tHaetlipoenr::ResultClass::Tee(3)
2
3
4
6 DBIx::Class::Helper::ResultClass::Tee - Inflate to multiple result
7 classes at the same time
8
10 my ($hashref, $obj) = $rs->search(undef, {
11 result_class => DBIx::Class::Helper::ResultClass::Tee->new(
12 inner_classes => [ '::HRI', 'MyApp::Schema::Result::User'],
13 ),
14 })->first->@*;
15
16 (If you've never seen "->@*" before, check out "Postfix-Dereference-
17 Syntax" in perlref, added in Perl v5.20!)
18
20 This result class has one obvious use case: when you have prefetched
21 data and DBIx::Class::ResultClass::HashRefInflator is the simplest way
22 to access all the data, but you still want to use some of the methods
23 on your existing result class.
24
25 The other important raison d'ĂȘtre of this module is that it is an
26 example of how to make a "parameterized" result class. It's almost a
27 secret that DBIx::Class supports using objects to inflate results.
28 This is an incredibly powerful feature that can be used to make
29 consistent interfaces to do all kinds of things.
30
31 Once when I was at Micro Technology Services, Inc. I used it to
32 efficiently do a "reverse synthetic, LIKE-ish join". The
33 "relationship" was basically "foreign.name =~ self.name", which cannot
34 actually be done if you want to go from within the database, but if you
35 are able to load the entire foreign table into memory this can be done
36 on-demand, and cached within the result class for (in our case) the
37 duration of a request.
38
40 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
41
43 This software is copyright (c) 2020 by Arthur Axel "fREW" Schmidt.
44
45 This is free software; you can redistribute it and/or modify it under
46 the same terms as the Perl 5 programming language system itself.
47
48
49
50perl v5.36.0 2022-D0B7I-x2:2:Class::Helper::ResultClass::Tee(3)