I am writing a website.

I use CGI, HTML::Template, CGI::Sessions, DBI

my working www folder structure is

cgi-bin : contains all *.pl scripts
html : html, pictures, JS, CSS
SQL : *.sql files to create databases, and play with queries
templates: all html/css templates of the application

the logic of work is next:
When I want to register I run register.pl, which uses query->prepare("sql query") functions to write to the db inside this script, create session with sessions.pm, show register form with register.tmpl template. When I want to show admin form I run admin.pl which does the whole job, sessions control, database operations, it shows admin form and so on
So the logic is that each separate pl file is responsible for his own single page of my website

Question: why do I feel that this method of writing web site (web application) is not normal, and how to write web application with correct arhitecture? What -is- correct arhitecture?


In reply to web applications: what is the correct way to realise web applications by tercoz

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.