Mason

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
 
(未显示1个用户的18个中间版本)
第1行: 第1行:
 +
{{top news}}
 
[[Image:masonhq_logo.gif|right]]
 
[[Image:masonhq_logo.gif|right]]
  
第8行: 第9行:
  
 
Mason支持的其他功能有:利用缓存构件进行回复;可以利用目录或分层结构十分轻松的创建模板;具有模拟不同环境下网页真实显示效果的能力。Mason特意针对Apache服务器和mod_perl做了优化。当然,Mason也可以作为CGI的标准模块被使用。
 
Mason支持的其他功能有:利用缓存构件进行回复;可以利用目录或分层结构十分轻松的创建模板;具有模拟不同环境下网页真实显示效果的能力。Mason特意针对Apache服务器和mod_perl做了优化。当然,Mason也可以作为CGI的标准模块被使用。
 +
 +
在线图书: [http://book.huihoo.com/embedding-perl-in-html-with-mason/index.html Embedding Perl in HTML with Mason] http://book.huihoo.com/i/cover_small.jpg
  
 
==安装指南==
 
==安装指南==
第13行: 第16行:
  
 
Debian用户
 
Debian用户
  #apt-get install libhtml-mason-perl  
+
  #apt-get install libhtml-mason-perl libhtml-mason-perl-examples
 +
// mason install to /usr/share/perl5/HTML/Mason
 +
If you have installed the apache-perl package, you don't need the following line.
 +
LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so
  
 +
vi /etc/apache-perl/conf.d/libhtml-mason-perl-examples.conf
 
  PerlModule HTML::Mason::ApacheHandler
 
  PerlModule HTML::Mason::ApacheHandler
  <Directory /home/www/vhosts/xxx.com/html>
+
  <Directory /var/www>
 
         SetHandler perl-script
 
         SetHandler perl-script
 
         PerlHandler HTML::Mason::ApacheHandler
 
         PerlHandler HTML::Mason::ApacheHandler
 
  </Directory>
 
  </Directory>
 +
hhttp://localhost/mason_example/
 +
or use httpd.conf
 +
<IfModule mod_perl.c>
 +
  Alias /perl/ /var/www/perl/
 +
  <Directory /var/www/perl>
 +
      <Files "*.html">
 +
      SetHandler perl-script
 +
      PerlHandler HTML::Mason::ApacheHandler
 +
    </Files>
 +
  </Directory>
 +
  PerlSetVar  MasonCompRoot /var/www/perl
 +
  PerlSetVar  MasonDataDir  /var/state/mason
 +
  PerlModule  HTML::Mason::ApacheHandler
  
 +
</IfModule>
 +
Using Mason from a CGI Script
 +
touch add.html
 +
<% 2 + 2 %>
 +
http://localhost/perl/add.html :)
 +
 +
The relevant portions of the httpd.conf file look like:
 +
DocumentRoot /path/to/comp/root
 +
ScriptAlias /cgi-bin/ /path/to/cgi-bin/
 +
 +
<LocationMatch "\.html$">
 +
  Action html-mason /cgi-bin/mason_handler.cgi
 +
  AddHandler html-mason .html
 +
</LocationMatch>
 +
  <LocationMatch "^/cgi-bin/">
 +
      RemoveHandler .html
 +
  </LocationMatch>
 +
<FilesMatch "(autohandler|dhandler)$">
 +
    Order allow,deny
 +
    Deny from all
 +
</FilesMatch>
 
Linux用户
 
Linux用户
 
  wget http://cpan.linuxforum.net/authors/id/D/DR/DROLSKY/HTML-Mason-1.35.tar.gz
 
  wget http://cpan.linuxforum.net/authors/id/D/DR/DROLSKY/HTML-Mason-1.35.tar.gz
第29行: 第70行:
 
  #./Build instal
 
  #./Build instal
  
 +
CGI and Mason Example Programs - http://mnementh.csi.cam.ac.uk/mason-course-examples/
 
==Related Links==
 
==Related Links==
 
*http://www.masonhq.com/
 
*http://www.masonhq.com/
第34行: 第76行:
 
*http://perl.apache.org/
 
*http://perl.apache.org/
 
*http://search.cpan.org/dist/HTML-Mason/
 
*http://search.cpan.org/dist/HTML-Mason/
 +
*[[Perl Apprenticeship Site]] - http://apprentice.perl.org/
 +
*http://www.alzabo.org/
  
 
==MasonPoweredSites==
 
==MasonPoweredSites==
第48行: 第92行:
 
*[[Mason-CM]]
 
*[[Mason-CM]]
  
[[category:Open_source_content_management_systems]]
+
{{Comment}}
 +
 
 +
[[Category:CMS]]
 +
[[Category:Perl]]

2010年10月31日 (日) 06:06的最后版本

Masonhq logo.gif

Mason - High-performance, dynamic web site authoring system

HTML中的Mason组件是基于开放Perl,用来创建维护网站的一个平台。最早是为了克服CGI的一些局限而开发的,CGI(Common Gateway Interface)是HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上。Mason的出现使得开发和管理大型网页的工作变得相对简单起来。其后Mason不断完善,目前已经是一个完整的开发工具了。1998年,基于Perl Artistic License的第一个HTML::Mason版本正式发行。  

Mason是一个结构化的可复用的组件库,包括HTML,Perl代码以及Mason命令。一个完整的网站首先要包括一个主要组件(父组件),在主要组件之中包括各种小型组件(子组件)。这种面向对象的机制,保证了当组件有所改变时,所有引用此组件的网页都会有所改变。这样网页设计人员(这些人通常都对组件编程不太精通)就可以忽略组件的内部机制问题,专心致志将精力放到整个网页的内容之上了。  

Mason支持的其他功能有:利用缓存构件进行回复;可以利用目录或分层结构十分轻松的创建模板;具有模拟不同环境下网页真实显示效果的能力。Mason特意针对Apache服务器和mod_perl做了优化。当然,Mason也可以作为CGI的标准模块被使用。

在线图书: Embedding Perl in HTML with Mason cover_small.jpg

目录

[编辑] 安装指南

前提是安装了 mod_perl

Debian用户

#apt-get install libhtml-mason-perl libhtml-mason-perl-examples 
// mason install to /usr/share/perl5/HTML/Mason

If you have installed the apache-perl package, you don't need the following line.

LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so
vi /etc/apache-perl/conf.d/libhtml-mason-perl-examples.conf
PerlModule HTML::Mason::ApacheHandler
<Directory /var/www>
       SetHandler perl-script
       PerlHandler HTML::Mason::ApacheHandler
</Directory>
hhttp://localhost/mason_example/

or use httpd.conf

<IfModule mod_perl.c>
 Alias /perl/ /var/www/perl/
  <Directory /var/www/perl>
     <Files "*.html">
      SetHandler perl-script
      PerlHandler HTML::Mason::ApacheHandler
    </Files>
 </Directory>
 PerlSetVar  MasonCompRoot /var/www/perl
 PerlSetVar  MasonDataDir   /var/state/mason
 PerlModule  HTML::Mason::ApacheHandler

</IfModule> Using Mason from a CGI Script

touch add.html
<% 2 + 2 %>
http://localhost/perl/add.html :)

The relevant portions of the httpd.conf file look like:

DocumentRoot /path/to/comp/root
ScriptAlias /cgi-bin/ /path/to/cgi-bin/
<LocationMatch "\.html$">
  Action html-mason /cgi-bin/mason_handler.cgi
  AddHandler html-mason .html
</LocationMatch>
 <LocationMatch "^/cgi-bin/">
     RemoveHandler .html
 </LocationMatch>
<FilesMatch "(autohandler|dhandler)$">
    Order allow,deny
    Deny from all
</FilesMatch>

Linux用户

wget http://cpan.linuxforum.net/authors/id/D/DR/DROLSKY/HTML-Mason-1.35.tar.gz
tar HTML-Mason-1.35.tar.gz
cd HTML-Mason-1.35
#perl Build.PL
#./Build
#./Build instal

CGI and Mason Example Programs - http://mnementh.csi.cam.ac.uk/mason-course-examples/

[编辑] Related Links

[编辑] MasonPoweredSites

http://www.masonhq.com/?MasonPoweredSites

[编辑] MasonPoweredApps

Comment-32x32.png

<discussion>characters_max=300</discussion>

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱