perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Villu Roogna" <>
Subject Application architecture and separating logic and design
Date Wed, 08 Nov 2006 07:47:35 GMT

I have set up my EMBPERL_OBJECT_APP file as sort of MVC controller:

For example in init I have conditionals like

if(basename($req->param->uri) =~ /^index(_eng)?\.html$/) {
    Front page logic

In index.html file I have several Execute statements for other templates
Execute({imputfile => 'section_news.html'});
Execute({imputfile => 'section_poll.html'}):

Now I would like to separate logic for section_news.html and
section_poll.html components in EMBPERL_OBJECT_APP file like this

if(basename($req->param->uri) =~ /^section_news\.html$/) {
     News section logic
} elsif(basename($req->param->uri) =~ /^section_poll\.html$/) {
    News section logic

that would allow me to remove section_news.html and section_poll.html logic
from index.html section in EMBPERL_OBJECT_APP

So I would like also component sub requests that I make in index.html go
through my EMBPERL_OBJECT_APP file so the logic would work like this:

User requests index.html ->
- Emperl would process all sections  (section_news.html and
section_poll.html) included with Execute statements in index.html in

User requests section_news.html directly ->
- Embperl would only process section_news.html in EMBPERL_OBJECT_APP file

The reason behind this would that I would not have to double my code for
index.html front page and for separate sections: section:_news and

Currently I could not get it to work since $req->param->uri gets the url
from main request not sub request. Also $req->component->sourcefile did not
work, since this parameter
did not get value until inside the actual component file.

What would be good way to implement the logic described or maybe there would
be even better ways that I now can not think of. I am open to all

Oh and thank you Gerald for one of the most flexible frameworks in perl :)

All the best,

View raw message