Is there an ORM for Perl?

 create table person
 (
     name varchar (15),
     attr1 varchar (15),
     attr2 varchar (1),
     attr3 char (1),
     attr4 int
 )

How can I use basic ORM in Perl by taking a simple table like the one above and matching it with Perl objects? Then, I would like to perform basic operations, such as selecting results, using some Perl criteria system, such as syntax. eg:.

@myResults = findAll(attr1 == 3 && attr2 =~ /abc/); 
+7
perl orm
source share
3 answers

Rule number 1, do not write your own.

There are many ORMs in CPAN, including ...

+26
source share

(Chiming late) Data :: ObjectDriver (also in CPAN) provides more flexibility, especially if partitioning and caching is included in your list of requirements.

0
source share

From the suggestions that I would use DBIx :: Class. Here is some code to introspect the database of old tables 50 (with the relationships indicated in the diagram):

 #!/usr/bin/perl use warnings; use strict; use DBIx::Class::Schema::Loader qw/ make_schema_at /; make_schema_at("Zotero::Schema", { # components => ['InflateColumn::DateTime'], debug => 1, relationships => 1, dump_directory => './lib' , }, ["dbi:SQLite:dbname=../zotero.sqlite", "",""]); 
0
source share

All Articles