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