Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Lady Aleena,

"'t Is costly wisdom that is bought by experience" as Roger Ascham, Scholemaster said.

Now for your project, it looks to me that the major part of your web-site is entirely static in nature, but that from time to time you add files and links and ... which must be reflected in the various pages you have on your site.

One solution would be to have the structure of the web-site "rendered" on the fly for every hit, but that seems wasteful of resources since the majority of the info did not change at all and once the changes have been rendered they should not be re-rendered when next this page is accessed.

Another --IMHO preferable-- solution is to use a templating system, such as Template::Toolkit to rebuild your site every time you change something. it has a lot of functionality already build in to add headers and footers. The pages are mostly pure HTML with the variable bits and pieces either written in the Template::Toolkit language (which is very close to Perl) or even directly in Perl itself.

In the docs of Template::Toolkit we read:

A number of special directives are provided, such as INSERT, INCLUDE and PROCESS, which allow content to be built up from smaller template components. This permits a modular approach to building a web site or other content repository, promoting reusability, cross-site consistency, ease of construction and subsequent maintenance. Common elements such as headers, footers, menu bars, tables, and so on, can be created as separate template files which can then be processed into other documents as required. All defined variables are inherited by these templates along with any additional "local" values specified.

Just like you and Perl, it took me a while to discover the beauty and usefulness of this templating system, but now I use it regularly (and not only to make web-sites). Check it out, it could empower your new understanding of Perl even more!

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


In reply to Re: Seeing Perl in a new light by CountZero
in thread Seeing Perl in a new light by Lady_Aleena

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (9)
    As of 2014-09-22 19:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (198 votes), past polls