Perl Web Frameworks
2011-03-23 15:40:08 阿炯

Perl has a large number of powerful frameworks for web development, some more actively used/developed than others. As with any technology choice you should review the documentation, check out the community (mailing list, irc channel, etc.) and ask lots of questions before choosing. This page makes an attempt to help you get started in that investigation.

Perl,这位曾经是web cgi世界里的老大,它拥有大量的web开发资源,当然也形成了不少的开发框架。如何根据自己的情况来选择成为有意做perl web开发的一个小难题,本文介绍一些相关的开发框架,以供参考(当然也就会用过的评价一下,纯属个人观点)。

Popular Frameworks

Popularity should never be the sole reason for choosing a technology, however more popular projects tend to have more docs, be more actively developed and have a larger community resource to learn from. The following frameworks (as far as this author knows) are being actively used and developed, and should be on the short-list for any new Perl web development projects.

* Catalyst--跟java一样,大而全,驾驭它需要更多的时间及精力。
http://dev.catalystframework.org/

* Jifty
http://jifty.org/view/HomePage

* CGI::Application--真正的鸡肋,有些组件写的相当不错。
http://cgi-app.org/

* WebGUI
http://www.webgui.org

Other Frameworks--其它框架并不代表它们没有上面所提及的优秀。

This is a list of other web frameworks out there, they are less well known, but may in fact be more what you want or need so worth at least taking a look at. Hopefully the authors of these frameworks will create linked wiki-pages so that they can tell us more about what makes their framework unique.

* Gantry
http://www.usegantry.org/

* Dancer--还行,不过不是很时髦。
http://search.cpan.org/dist/Dancer/

* Egg
http://search.cpan.org/dist/Egg-Release/

* Maypole--也比较大,需要较多的时间精力去掌握。
http://maypole.perl.org/

* Solstice
http://search.cpan.org/dist/Solstice/

* ClearPress
http://search.cpan.org/dist/ClearPress/

* CGI::Prototype
http://search.cpan.org/dist/CGI-Prototype/

* Konstrukt
http://search.cpan.org/dist/Konstrukt/

* Tripletail
http://search.cpan.org/dist/Tripletail/

* MasonX::MiniMVC
http://search.cpan.org/dist/MasonX-MiniMVC/

* Rest::Application
http://search.cpan.org/dist/REST-Application/

* Squatting
http://search.cpan.org/dist/Squatting/

* Mojolicious--很值得深入学习,有很多时下新特性(内置事件、html5等),上手较易。
http://mojolicious.org/

* Cyclone3
http://www.cyclone3.org/

* WebNano
http://github.com/zby/WebNano

Older Frameworks

Being in this list is not a bad thing, older frameworks (that are still around) are stable frameworks. However, that said, they may not be as up to date on current best practices. If the things listed above are not your style, give these oldies-but-goodies a look.

* Apache::PageKit
* Mason--While Mason has framework pieces, it can also be used as just a templating engine inside another framework such as Catalyst or Jifty.
* OpenInteract

Advice on Choosing a Framework-选择一个框架的建议


Most of the popular/major frameworks support multiple templating (i.e. Template Toolkit or HTML::Mason) and class (i.e. Class::DBI, DBIx::Class or Rose::DB::Object) libraries, so this usually isn't a worry.

The main things to consider would be the level of support and matching it to your requirements - there are several lightweight options such as CGI::Application or MasonX::MiniMVC, and more complex / powerful options such as Catalyst or Jifty - next it's probably wise to see how the framework fits the problem - can you make the solution fit well with an "opinionated" framework (i.e. Jifty), or do you need something more flexible (i.e. Catalyst).

There may already be an application that does what you want, without have to learn the low-level details of a particular framework.

相对于mod_perl这种原生的开发方式,许多框架都带有了web服务器,你甚至不在需要像apache或nginx这类传统的web服务器,而且性能上个别还超过传统的web服务器。这与php的框架有区别的,当然也不仅是这个方面的区别,在深入学习和使用的过程里会发现更多的特点。

该文章最后由 阿炯 于 2013-01-08 11:28:53 更新,目前是第 2 版。