Apache-ASP

 view release on metacpan or  search on metacpan

site/syntax.html  view on Meta::CPAN


		</tr>
		
		<tr>
		<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr>&nbsp;</nobr></b></font></td>

		<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="todo.html" style="text-decoration:none"><font color=#063678>TODO</font></a></nobr></b></font></td>		

		</tr>
		
		<tr>
		<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr>&nbsp;</nobr></b></font></td>

		<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="changes.html" style="text-decoration:none"><font color=#063678>CHANGES</font></a></nobr></b></font></td>		

		</tr>
		
		<tr>
		<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr>&nbsp;</nobr></b></font></td>

		<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="license.html" style="text-decoration:none"><font color=#063678>LICENSE</font></a></nobr></b></font></td>		

		</tr>
		<tr><td colspan=2><hr size=1></td></tr>
		<tr>
		<td bgcolor=white><font size=-2 face="verdana" color=#993399><b><nobr>&nbsp;</nobr></b></font></td>

		<td bgcolor=white ><font face="verdana,helvetica" size=-1><b><nobr><a href="eg/index.html" style="text-decoration:none"><font color=#063678>EXAMPLES</font></a></nobr></b></font></td>		

		</tr>
		
	</table>

	</td></tr>
	</table>

		<br>
		<center>
		<a href=http://www.apache-asp.org/><img src="powered_by_apache_asp.jpg" width="88" height="31" alt="Powered by Apache::ASP" border="0"></a>
		<br>
		<a href=http://perl.apache.org><img src="powered_by_modperl.gif" width="88" height="31" alt="Powered by ModPerl and Apache" border="0"></a>
		<br>
		<a href=http://www.perl.com><img src="rectangle_power_perl.gif" width="88" height="31" alt="Powered by Perl" border="0"></a>


</center>

</td>



<td valign=top bgcolor=white>
<font size=+0 face=verdana,arial>

<font face=verdana><font class=title size=+1 color=#555555><b>SYNTAX</b></font>
</font>

	<hr size=1>
	<table width=100% border=0 cellpadding=1 cellspacing=3>
	<tr>
	<td valign=top><font face="lucida console" size=-1>
	
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#General>General</a>
			</font>
			</td>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#Editors>Editors</a>
			</font>
			</td>
							
		</tr>
		
		<tr>
		
			<td valign=top >
			<font face="lucida console" size=-1>
			<a href=#XMLSubs>XMLSubs</a>
			</font>
			</td>
		<td>&nbsp;</td>					
		</tr>
			
	</table>
	<hr size=1>
	<p>

	<p>
	<a name=General></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>General</b></font>
<font face="courier new" size=3><pre>
</pre></font>ASP embedding syntax allows one to embed code in html in 2 simple ways.
The first is the &lt;% xxx %&gt; tag in which xxx is any valid perl code.
The second is &lt;%= xxx %&gt; where xxx is some scalar value that will
be inserted into the html directly.  An easy print.
<font face="courier new" size=3><pre>
  A simple asp page would look like:
  
  &lt;!-- sample here --&gt;
  &lt;html&gt;
  &lt;body&gt;
  For loop incrementing font size: &lt;p&gt;
  &lt;% for(1..5) { %&gt;
	&lt;!-- iterated html text --&gt;
	&lt;font size=&quot;&lt;%=$_%&gt;&quot; &gt; Size = &lt;%=$_%&gt; &lt;/font&gt; &lt;br&gt;
  &lt;% } %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;!-- end sample here --&gt;
</pre></font>Notice that your perl code blocks can span any html.  The for loop
above iterates over the html without any special syntax.</font>
	
	<p>
	<a name=XMLSubs></a>
	<font face=verdana><font class=title size=+0 color=#555555><b>XMLSubs</b></font>
<font face="courier new" size=3><pre>
</pre></font>XMLSubs allows a developer to define custom handlers for
HTML &amp; XML tags, which can extend the natural syntax
of the ASP environment.  Configured like:
<font face="courier new" size=3><pre>
  PerlSetVar XMLSubsMatch site:\w+
</pre></font>A simple tag like:
<font face="courier new" size=3><pre>
  &lt;site:header title=&quot;Page Title&quot; /&gt;
</pre></font>can be constructed that could translate into:
<font face="courier new" size=3><pre>
  sub site::header {
      my $args = shift;
      print &quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;$args-&gt;{title}&lt;/title&gt;&lt;/head&gt;\n&quot;;
      print &quot;&lt;body bgcolor=white&gt;\n&quot;;
  }
</pre></font>Better yet, one can use this functionality to trap
and post process embedded HTML &amp; XML like:
<font face="courier new" size=3><pre>
  &lt;site:page title=&quot;Page Title&quot;&gt;
    ... some HTML here ...
  &lt;/site:page&gt;



( run in 0.753 second using v1.01-cache-2.11-cpan-39bf76dae61 )