Substitution Tags(替换标签)

  % $cd_count = ; # this is embedded Perl
You have <% $cd_count %> CDs.

Escaping substitutions(转义替换), 两个字符 h(html),u(URL),n(不转义)

<textarea name="foo"><% $foo_data | h %></textarea>
Homepage: <a href="redirect?url=<% $homepage | u %>">   

Embedded Perl: % Lines and <%perl> Blocks (嵌入perl)

  % foreach my $person (@people) {
Name: <% $person->{name} %>
Age: <% $person->{age} %>
Height: <% $person->{height} %>
Weight: <% $person->{weight} %>
% }

如果有多行则可以用<%perl> </%perl>

If you have more than a few lines of Perl code in a row, however, it is probably best to use a Perl block instead
<%perl>
my @words = $sentence =~ /\b(\S+)\b/g;
my @small_words = grep { length $_ <= } @words;
my @big_words = grep { length $_ > } @words;
</%perl>

Calling Other Components: <& &> Tags   调用其它组件

调用组件

<& /path/to/menu &>
<& $component &>
<& menu, width => , admin => &>

可以用+或者()表示为表达式运行

<& ( component_path_returner( ) ) &>
<& +component_path_returner( ) &>

<%init> blocks , 初始化块

 It is currently <% $temp %> degrees.
<%init>
my ($temp) = $dbh->selectrow_array("SELECT temperature FROM current_weather");
</%init>

<%args>

<%args>
$color #是必需要传入数据的
$size =>
@items => ( , , 'something else' )
%pairs => ( key1 => , key2 => 'value' )
</%args>

获取提交表单值 $ARGS{'submit.x'}

% foreach (sort %ARGS) {
<% $_ %>
% } % foreach (sort @_) {
<% $_ %>
% }

可通过http传递获取参数

the mason book

												

最新文章

  1. Mysql联合,连接查询
  2. 3dmax导出到blend或者vs中
  3. Python之路【第六篇】python基础 之面向对象(一)
  4. Android 本地/网路下载图片实现放大缩小
  5. 劳动节脑洞大开!利用Debug API 获取 加壳客户端的MD5值
  6. Java学习-038-JavaWeb_007 -- JSP 动作标识 - plugin
  7. C# 程序开始主要是写类和方法 的基本步骤和调用方法
  8. CodeForces 362B Petya and Staircases
  9. nyoj 37
  10. 关于bootstrap--列表(ol、ul)
  11. A Simple Problem with Integers(线段树,区间更新)
  12. JAVA连接ACCESS、MYSQL、SQLSEVER、ORACLE数据库
  13. KVO等具体实现步骤以及注意事项
  14. 关于while read line 循环中变量作用域的问题
  15. html/css 表格元素以及表格布局
  16. 记一次阿里云服务器被用作DDOS攻击肉鸡
  17. Exception in thread &quot;main&quot; java.lang.StackOverflowError at java.util.ArrayList$SubList.rangeCheckForAdd(Unknown Source)
  18. LintCode Binary Search
  19. IT行业的创新的读后感
  20. sudo apt-get update 去除设置的代理

热门文章

  1. The ninth day
  2. sublime介绍常用插件和快捷键
  3. 工作流常使用API
  4. Lua相关函数整理
  5. Spring Boot入门程序-STS
  6. Sql_Server中如何判断表中某字段是否存在
  7. jshint-eclipse: JavaScript Code Quality Plugin for Eclipse
  8. 安装xp系统步骤
  9. N76E003---看门狗
  10. P2447 [SDOI2010]外星千足虫