"Perrin Harkins" <[EMAIL PROTECTED]> writes: > In my view, Apache::Template fosters bad habits because it makes it > more difficult to keep your application logic separate. If the > service stuff was expanded to provide something along the lines of > the (Java) Struts project (i.e. config-based mapping of a URI to a > module which runs some application logic and then selects a template > for the view), that would be cool. Right now it maps URIs directly > to template files, which is usually not good for applications doing > anything fancier than SSI-ish templating. (Sure, you can subclass > it and change all of this, but newbies aren't going to grasp that > easily.)
That's backwards. The basic thing is to find information. GET = Retrieve information, specified by path POST = Submit information, specified by post data I have used the same model for many projects now. Every request consists of two parts. 1. Affect the database in some way (create, update, delete) 2. View information Those two are separated. You could update a record of some typy but at the same time retrieve data about another type. A commen example is the case there you update a record and goes back to the main page. I think that this modell works well. It's usually easy to write each template only as a displayer of information. Simple select statements are almost always enough. (But using a library of widget abstractions.) The other part is the library of diffrent actions that does stuff. They are implmented as perl functions / modules. I now uses mod_perl with a specialized handler. The path decides the template and the action is specified by the 'run' key in the POST or QUERY string. The result from the action is sent as extra data to the template and can be viewd there. I have chosen to let a failure of an action to result in that the previous page is redisplayed. That's what usually is needed to bring back the same forms so that the user can try to do something else. (The mod_perl handler redirects the browser to the right page.) Eh... What I wanted to say was that I think it keeps the application logic separate. And the handler actually require() the requested action handler and then loades the template specified by the path unless one of the action funktions decides to redirect the browser. -- / Jonas - http://jonas.liljegren.org/myself/en/index.html
