Perl Programming Page 2 - Site Layout with Perl Templating Tools |
Next, well think about what the index has to be. As we've said, we're going for a two-column design, something like Example 3-8. Example 3-8. index.html <table> <tr> <%INIT> </td> %# Am I logged in ? </table> <%ARGS> As promised, the column on the left contains a login box and the directory of feeds. The right-hand side has three states: one pane for those who are logged in (which is ifdef'ed out since user control is left for future expansion), one if a particular directory has been opened, and one if the user has just come to the site's front page.* What about the value of $open ? Mason allows components to take arguments, either via CGI or by being passed in from other components. In this case, index.html is a top-level component and will receive its arguments via CGI--that is, if we request the URL http://www.oursite.com/rss/index.html?open=News, then $open will be set to News. The directory pane component receives its arguments from index.html, and so we pass it the value of $open we received. Because $open later names a directory on the web server, we sanitize its value to avoid directory-perusal attacks such as passing in a query of
blog comments powered by Disqus |