in reply to Problem with Mason, can it be solved with a subrequest?
This answer is, I admit, not so much a solution to your current problem, but rather a (very) different way of designing your web app that stops this being an issue.
The way I do it with perl/mason (which is not necessarily the best way) is to have a two pass apporach to every page. I borrowed this idea from the AOLServer templating system (and others) where you have a seperate template and code page.
In essence, each web request to one of my systems first runs a logic script (actually it instantiates an object of the right class, but you don't have to use OO) and then renders a template.
This may not be clear, so lets take an example:
There are a lot more subtleties to my actual implementation (which I hope to be able to release to CPAN with the appropriate authorisation), but the basic idea of processing logic first, and rendering the template second is relatively easy to implement using mason, and gives you a lot more power in situations like this.
I know that mason has it's own way of allowing method calls within the mason framework, but I believe it was Randall Scwhartz (or possibly Ken Williams) who said (on the mason mailing list) something like "if something can be done in a perl module, it probably should".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Seperating logic from web display using mason
by EvanCarroll (Chaplain) on Oct 02, 2005 at 02:00 UTC | |
|
Re: Seperating logic from web display using mason
by aufflick (Deacon) on Oct 02, 2005 at 12:33 UTC |