简体   繁体   English

我应该使用哪个Perl Web框架?

[英]Which Perl web framework should I use?

I would like to develop a web application using Perl. 我想使用Perl开发一个Web应用程序。

Refer some Perl package (like Strawberry ) which is simple to install. 参考一些易于安装的Perl包(如草莓 )。 Also it should be suitable for the web application. 它也应该适用于Web应用程序。

Have a look at Mojolicious , a complete and modern framework for Web applications whose only requirement is Perl (no additional modules required!). 看看Mojolicious ,一个完整的现代Web应用程序框架,其唯一要求是Perl(不需要额外的模块!)。

To install it, just download a Strawberry Perl version and issue cpan Mojolicious : no dependencies required. 要安装它,只需下载Strawberry Perl版本并发布cpan Mojolicious :不需要依赖项。 Or, download the latest tar.gz for Mojolicious, unpack it, and perl Makefile.PL && make test install . 或者,下载最新的tar.gz for Mojolicious,解压缩它,以及perl Makefile.PL && make test install

With it, you get a Modern Perl web client, server, MVC framework, plugins, websockets, templating engine... you name it, and the only requirement is Perl (5.8.8+). 有了它,你会得到一个Modern Perl Web客户端,服务器,MVC框架,插件,websockets,模板引擎......你可以命名,唯一的要求是Perl(5.8.8+)。

Alternatively, have a look at Catalyst , which has a bit more requirements than Mojolicious but also has a couple books out, and a bigger community behind it. 或者,看看Catalyst ,它比Mojolicious有更多的要求,但也有几本书,以及一个更大的社区背后。

You can install all sorts of Modern Perl goodies having a look at Task::Kensho . 您可以安装各种Modern Perl好吃的东西,看看Task :: Kensho Its purpose is to have all Modern Perl modules one uses to develop web applications, etc. If any of the prerequisites don't install, file a bug report as it is supposed to Just Work 它的目的是让所有Modern Perl模块用于开发Web应用程序等。如果没有安装任何先决条件,请提交错误报告,因为它应该是Just Work

Try out Dancer - Effortless Web Framework . 试试Dancer - Effortless Web Framework It is very easy to use. 这是非常容易使用。

#!/usr/bin/perl

use Dancer;

get '/hi' => sub {
    "Hello World!"
};

dance();

For starters, I always recommend looking at CGI::Application with HTML::Template as the templating engine. 对于初学者,我总是建议使用HTML :: Template作为模板引擎来查看CGI :: Application Simple enough to install and start with, lightweight and still packed with enough punch to keep everyone (well almost) happy! 简单到足以安装和开始,轻巧,仍然充满了足够的冲击,以保持每个人(几乎)快乐!

About 10 years ago, I was busy doing full time web app development with Embperl 2.0 betas. 大约10年前,我忙于使用Embperl 2.0 beta进行全职Web应用程序开发。 It was certainly nice to work with at the time. 当时合作当然很好。 It seems to have been maintained with bug fixes etc since then, but fundamentally hasn't changed much since then. 从那以后,它似乎一直保持着bug修复等,但从那时起基本没有太大变化。

A few years ago I researched all the Perl WAFs but didn't find anything really appealing. 几年前,我研究了所有的Perl WAF,但没有发现任何真正吸引人的东西。 At work, we are using Python+Django but there doesn't seem to be a solid Perl version. 在工作中,我们使用的是Python + Django,但似乎没有一个可靠的Perl版本。

Thus for any quick & dirty web project I'm still resorting to just good old CGI.pm. 因此,对于任何快速和肮脏的Web项目,我仍然只使用好的旧CGI.pm. I'm still a Perl guy at heart. 我仍然是一个Perl家伙。

At the moment I'm again researching all the latest Perl toolkits and Mojolicious with DBIx::Class certainly seeems to be the way to go! 目前我正在研究所有最新的Perl工具包和Mojolicious与DBIx :: Class肯定是最好的方式!

What I haven't found an answer for yet is how to easily build rich user interfaces for database applications with Mojolicious, without having to worry much about generating HTML tables and doing usual CRUD. 我还没有找到答案的是如何使用Mojolicious为数据库应用程序轻松构建丰富的用户界面,而不必担心生成HTML表格和执行常规CRUD。

I do recommend Mojolicious, especially their micro framework Mojolicious::Lite , which gets you started pretty fast. 我推荐Mojolicious,特别是他们的微框架Mojolicious :: Lite ,它可以让你快速入门。 It doesn't have the kind of documentation like Catalyst, but it is growing. 它没有像Catalyst这样的文档,但它正在增长。 No dependency, other than core Perl, should ease the pain of getting you started. 除了核心Perl之外,没有任何依赖可以缓解让你入门的痛苦。

Embperl is still being maintained, although it is kinda quiet on the mailing list. 尽管在邮件列表上有点安静,但Embperl仍在维护中。

Embperl might be an option for small sites. Embperl可能是小型网站的选择。

It is conceptually similar to PHP, but more powerful. 它在概念上类似于PHP,但功能更强大。 Fast (due to lots of C bindings), still easy to install (preferably from command line), works best with mod_perl, but a CGI operating mode is also supported. 快速(由于大量的C绑定),仍然易于安装(最好是从命令行),最适合mod_perl,但也支持CGI操作模式。

Though, I haven't used all its advanced features (embedding xml-libs, configuring https, for instance), but it is great to use perl on the data-output side, when you have perl also on the data input side (data staging/scrubbing). 虽然,我没有使用它的所有高级功能(例如嵌入xml-libs,配置https),但是当你在数据输入端也有perl时,在数据输出端使用perl很棒(数据)分段/洗涤)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM