Mason是一个框架吗?
我和一位朋友一直认为 Mason (Perl) 不是一个框架,而是一种模板语言。 我觉得 Mason for Perl 所做的事情就像 JSP 对于 Java 所做的那样(作为类比,而不是纯粹的技术比较)。 据我所知,JSP不是一个框架,我觉得Mason也不是。 当我查找维基百科 Mason (Perl) 时,我看到主站点说它是一个用 Perl 编写的 Web 应用程序框架,而讨论页面则对其进行了争论。
关于为什么它是/不是框架的任何指示?
根据 ysth 的评论进行更新: 对于一个框架,我认为它至少应该使数据库访问变得容易,管理会话,网络应用程序所需的基本安全性,模板和代码重用(或使基本任务变得容易的库)。
I've been having an agruement with a friend that Mason (Perl) is not a framework, but a templating language. I feel Mason for Perl does what JSP does for Java (as an analogy, not pure technical comparison). From what I know, JSP is not a framework and I feel neither is Mason. When I looked up wikipedia Mason (Perl), I see that the main site says it is a web application framework written in Perl while the discussion page contests it.
Any pointers on why it is/ it is not a framework?
Update based on comments from ysth:
For a framework, I feel it should at least make db access easy, manage sessions, basic security that a webapp would need, templating and code reuse (or libraries that make basic tasks easy).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
Mason 是 MVC(模型-视图-控制器)框架的缩写。 它提供了广泛的渲染(View)功能,这就是为什么人们认为 Mason 是一种模板语言。 然而,它还提供了相当多的调度机制(特别是以 dhandlers 的形式)和控制机制(自然适合自动处理程序)。
几年前,我写了一个在线教程(用 Mason 语言)来展示一些这些功能。 它针对全屏显示进行了优化,并且需要启用 JavaScript。
Mason没有给你的是数据库抽象层,所以你必须带上自己的Model。
据我所知,amazon.com 以及许多其他网站都是用 Mason 编写的。
如果您喜欢与 Mason 合作,但想要一个模特、更多玩具和一匹小马,那么您可以考虑查看 Jifty 作为一个 Web 应用程序框架。
Mason is an 'M' short of being a MVC (Model-View-Controller) framework. It provides extensive rendering (View) features, which is why people think of Mason as being a templating language. However it also provides quite a few dispatch mechanisms (epsecially in the form of dhandlers), and control mechanisms (which fit naturally into autohandlers).
A few years ago I wrote an on-line tutorial (in Mason) to show off some of these features. It's optimised for full-screen display, and needs javascript enabled.
What Mason doesn't give you is a database abstraction layer, so you have to bring your own Model.
To the best of my knowledge amazon.com is written in Mason, along with many other sites.
If you enjoy working with Mason, but you'd like to have a Model, more toys, and a pony, then you may consider looking at Jifty as a web application framework.
模板系统类似于
HTML::Template
,即仅执行模板化的模块。我觉得
Mason
做得更多,它有某种路由机制,它通过%ARGS
提供参数处理,通过%INIT
提供初始化。它还提供了
mod_perl
、CGI
的接口...现在,它不与数据库对话,就好像您想要一种干净的方式来做到这一点,您将拥有使用
Class::DBI
、DBIx::Perlish
或其他数百个执行对象映射的 perl 模块之一,或其他任何...A templating system would be something like
HTML::Template
, that is, a module that only does templating.I feel that
Mason
does more, it has somehow a routing mechanism, it provides argument handling though%ARGS
, intialisations through%INIT
.It also provides interfaces to
mod_perl
,CGI
...Now, it does not talk to the database, as if you want a clean way to do it, you'll have to use
Class::DBI
,DBIx::Perlish
or one of the other hundred perl modules that does object mapping, or whatever else...它不是 Model-View-Controller 类型的框架,它可能是例如,比 Ruby on Rails 更接近 PHP(而且从我所看到的情况来看也同样糟糕)。
It is not an Model-View-Controller type of framework, it is probably closer to PHP than Ruby on Rails for example (and just as bad from what I have seen of it).
如果不看 HTML::Mason 是否是一个框架,就无法回答这个问题,但我总是对以下定义感到满意......
Can't answer the question to whether HTML::Mason is or isn't a framework without looking at it but I'm always happy with the following definition....
查看 使用 Mason 在 HTML 中嵌入 Perl 的视图它的竞争对手,我想说它是一种模板语言。 否则 Catalyst 和 五月柱将在列表中。 另外,我想我在某处读到您可以使用 Mason 作为 查看 Catalyst 应用程序中的部分。
我想我可以看到你可以在哪里像框架一样使用它,但如果你将它视为模板语言,它似乎会更完整。
Looking at Embedded Perl in HTML with Mason view of its competition, I'd say it is a template language. Otherwise Catalyst and Maypole would be on the list. Also, I think I read somewhere that you can use Mason as the View portion in a Catalyst application.
I guess I can see where you can use it like a framework, but it seems to be more complete if you view it as a template language.
Mason 本身并不是一个框架,它只是一个模板系统,但具有一些非常酷的功能。 它有自己的结构,您可以非常轻松地在其中嵌入 Perl 代码,而且它还具有缓存支持。 我见过有人单独使用 Mason 来开发大型应用程序,但我认为它在 MVC 框架中效果更好。
小心!
Mason alone is not a framework it's just a template system BUT with some very cool features. It's got it's own structure and you can embed perl code very easely in it also it's got cache support. I've seen people who use Mason alone for developing a large application, but I guess it works better in an MVC framework.
Take care!
以下框架的定义取自 Gamma 的《设计模式》一书。 “框架是一组协作的类,它们构成了特定类软件的可重用设计。” 根据这个定义,梅森是一个框架。 MVC 框架只是一种类型的框架。
The following definition of a framework is taken from the Gamma book on Design Patterns. "A framework is a set of cooperating classes that make up a reusable design for a specific class of software." Mason, by that definition, is a framework. An MVC framework is only one type of framework.
HTML::Mason 是框架老化后想要成为的样子。 使用 HTML::Mason,您可以获得:
它是为高性能多层 Web 应用程序而设计的,而不是为了取悦从桌面编程借用的设计模式(例如 MVC)的粉丝。
HTML::Mason is what frameworks want to become when they get older. With HTML::Mason you get:
It was designed for high performance multi-tiered web applications, not for pleasing the fans of design patterns borrowed from desktop programming (such as MVC was).
取决于您对框架的定义。
如果任何库执行不止一件事,您可以将名称框架应用于该库。
Depends of your definition of framework.
You can apply name framework to any library if it does more than one thing.