Perl是否有ORM? [英] Is there an ORM for Perl?
本文介绍了Perl是否有ORM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
create table person
(
name varchar(15),
attr1 varchar(15),
attr2 varchar(1),
attr3 char(1),
attr4 int
)
如何通过像上面的表格一样简单的表并将其映射到Perl对象来在Perl中使用基本的ORM?接下来,我想使用一些标准系统Perl(例如语法)执行诸如选择结果之类的基本操作.例如:
How I can use basic ORM in Perl by taking a simple table like the one above and mapping it to Perl objects? Next I'd like to perform basic operations like select results using some criteria system Perl like syntax. eg.:
@myResults = findAll(attr1 == 3 && attr2 =~ /abc/);
推荐答案
规则1,不要自己写.
CPAN上有很多ORM,包括...
There are quite a number of ORMs on CPAN, including ...
- DBIx :: Class -目前可能排名第一>
- Rose :: DB :: Object
- Fey :: ORM -我自己的贡献,最出名的是基于Moose ,这意味着您可以在基于ORM的类中获得Moose的全部功能.
- DBIx::Class - probably #1 in popularity at the moment
- Rose::DB::Object
- Fey::ORM - my own contribution, most notable for being Moose-based, which means you get all the power of Moose in your ORM-based classes.
这篇关于Perl是否有ORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文