Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

web applications: what is the correct way to realise web applications

by tercoz (Acolyte)
on Dec 30, 2011 at 06:10 UTC ( #945605=perlquestion: print w/ replies, xml ) Need Help??
tercoz has asked for the wisdom of the Perl Monks concerning the following question:

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?

Comment on web applications: what is the correct way to realise web applications
Re: web applications: what is the correct way to realise web applications
by Anonymous Monk on Dec 30, 2011 at 07:29 UTC

    Question: why do I feel that this method of writing web site (web application) is not normal

    You have got a screw loose :)

    and how to write web application with correct arhitecture? What -is- correct arhitecture?

    There is no correct architecture :)

    I've only read a little about "software architecture" , but I'm pretty sure what you've described is called design, not architecture

    See these links, and these and these links

      There are many rumours about MVC and that things like cgi::application force a programmer to follow definite rules as he design his application, I have read about this way of making applications and didn't find any advantage in this way.

      MVC that's what make me curious, is it really better than simply using single scripts for single tasks

        There are many rumours about MVC and that things like cgi::application force a programmer to follow definite rules as he design his application, I have read about this way of making applications and didn't find any advantage in this way.

        MVC that's what make me curious, is it really better than simply using single scripts for single tasks

        Reading is never as convincing as understanding :) and the right kind of exercise can promote understanding

        I remember reading about MVC before I did any OOP, and I didn't see any benefits either :)

        Its like trying to understand the benefit of stick-frame-housing-in-earthquake-zones when you're living in a cave :) You mean to tell me I have to cut trees down, then nail them ... but the cave is right there :)

        Based on this thread along with is this script secured enough from internet attacks, I believe you need to read/write more code, more programs, more big and OO programs, before you can appreciate the benefits of MVC or scaffolding like mojo/dancer/catalyst/cgi-app

        Oh look, a single script for a single task, without MVC or OOP, admin.cgi

        use MyShinyPoodle::Admin::CGI; MyShinyPoodle::Admin::CGI->run;

        Now you can test MyShinyPoodle::Admin , and it doesn't depend on any html templates or protocols like CGI

        See also Object Oriented Orientation

        Good luck

Re: web applications: what is the correct way to realise web applications
by pajout (Curate) on Dec 30, 2011 at 10:00 UTC
    I think there is not the best way how to do it. My experience is that if you firstly write software requirements, i.e. WHAT it should do (not HOW), in exact details, choosing proper technologies, data organization and coding become more clear.

    Btw, your folder structure is good, in my opinion. - If it fullfils your requirements :>) You can inspire with Bugzilla project, also using CGI scripts and HTML::Template.

      Good point.

      I often start with a question HOW

      Gotta look on things at the other angle))

        Perhaps this would help
        http://secs.ceas.uc.edu/~cpurdy/sefall11/ReqsDoc.pdf
        I never had believed such documents, perhaps never had understood. But praxis forced me to understand :>)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://945605]
Approved by sflitman
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2014-08-21 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (136 votes), past polls