maston总结
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传递获取参数
maston总结的更多相关文章
随机推荐
- $.ajax显示进度条
- Oracle11g 卸载教程图解
1:停掉所有Oracle相关的服务 1.1打开服务方式如下: 1.1.1:右击“计算机”–>管理–>服务和应用程序–>服务 1.1.2:开始–>输入“服务”后点击搜索–> ...
- 笨办法学Python(十二)
习题 12:提示别人 当你键入 raw_input() 的时候,你需要键入 ( 和 ) 也就是“括号(parenthesis)”.这和你格式化输出两个以上变量时的情况有点类似,比如说 "%s ...
- ubuntu linux double tab
在terminal中,输入部分指令,再按两下Tab键,可以显示以相关的指令
- Linux上mariadb数据库(博客初学者使用测试)
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可.MariaDB由MySQL的创始人麦克尔·维德纽斯主导开发,他早前曾以10亿美元的价格,将自己创建的公司M ...
- C++学习之拷贝构造函数
嘛是拷贝构造函数? 如果一个构造函数的第一个参数是’自身类‘ ‘类型’的引用,且任何额外参数都有默认值,则此构造函数是拷贝构造函数.如: [代码1] 1 2 3 4 5 6 class A{ publ ...
- spring boot学习1
转:https://blog.csdn.net/jsyxcjw/article/details/46763639 1 开始 1.1 spring介绍 Spring Boot使开发独立的,产品级别的基于 ...
- 问题 C: P4 游戏中的Human角色
题目描述 在一个平面打斗游戏中,任何的角色(Role)都有血量(blood)和位置loc(此处loc是Location类的实例)属性.有了Role类,可以派生出不同的角色,如人.神仙.怪兽等.如下程序 ...
- centos安装django
1.如果默认安装的是python2.6,先升级至python2.7 参考:http://www.cnblogs.com/tiger2soft/p/5677843.html 2.安装pip 先下载get ...
- 面试-Spring理解
转自http://hui.sohu.com/infonews/article/6331404387079946240 spring呢,是pivotal公司维护的一系列开源工具的总称,最为人所知的是sp ...