zoukankan      html  css  js  c++  java
  • maston总结

    Substitution Tags(替换标签)

      % $cd_count = 207; # 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 =~ /(S+)/g; my @small_words = grep { length $_ <= 3 } @words; my @big_words = grep { length $_ > 3 } @words; </%perl>
    
    
    

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

    调用组件 

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

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

    <& ( 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 => 20
       @items => ( 1, 2, 'something else' )
       %pairs => ( key1 => 1, key2 => 'value' )
      </%args>

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

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

    可通过http传递获取参数

    the mason book



  • 相关阅读:
    妈妈之歌 The Mom Song 中文字幕
    40个实用的轻量级JavaScript库
    2009超强流行词汇
    60+CSS技巧教程资源大全
    关于zindex的那些事儿
    FF和IE之间7个JavaScript的差异
    IE6 不支持PNG问题
    邮件营销EDM模板制作规范
    css层的定位position、absolute、relative层叠加的五条叠加法则
    IE8的CSS hack
  • 原文地址:https://www.cnblogs.com/qinzb/p/9002956.html
Copyright © 2011-2022 走看看