On 10/05/18 18:00, Robert Rothenberg wrote:
> ...
Assuming that is the way... I am wondering if it's possible to create a new
result source class at runtime (and if so, how).
After a bit of close reading of the docs and source, the following seems to
work:
# Create the (anonymous) class based on resultset $rs as
# $class = $namespace . "::" . $name
my $schema = $rs->result_source->schema;
$schema->load_classes( { $namespace => [ $name ] } );
return $schema->source( $class )->resultset
Is that all there is?
Ok, there are some complication, such as the table name to use, and the base
class.
Do I really need to register it, or can I get away with returning a
resultset from the result_source_instance, especilly if I want to use it
anonymously?
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]