On Sunday, March 17, 2002, at 09:26  AM, Kee Hinckley wrote:

> Using Embperl's EmbperlObject model you could do this automatically in 
> a readable fashion.  Loading "login" would wrap it in a top-level 
> template automatically.  Or alternatively you could have "login.html" 
> include "index.pl" and then call the appropriate routines at the 
> appropriate places.
>
> The other big advantage you'll get using a package like HTML::Embperl 
> over doing it yourself with .pl files is caching.  The perl files will 
> get compiled once, and then the code will be reused.  You also don't 
> have to worry about cross-site scripting security issues, since Embperl 
> always escapes user's input appropriately for the context.
>
....
>
> After several years using my own embedded perl scripting solution I 
> took a close look at Mason and Embperl and went with Embperl.  It's 
> been several years more now, and with the XML support being added in 
> Embperl 2.0, I'm feeling very good about that solution.  Other's might 
> prefer Mason.  But I would definitely recommend either package over 
> straight CGI and home-brew templates.
>

I am glad I asked, because I just spent a good part of last night 
setting up Mason. I can't get it to work correctly because my mod_perl 
is buggered up (my previous emails ask for help on that issue), but I 
have got it working as a CGI (being called via handler.pl). So, I have 
one vote for Mason, and now one vote for Embperl... choice is good, but 
choice is also confusing... but heck, that _is_ the Perl way, no :-)

I will give Embperl a go now and see how it compares to Mason.

> At 7:37 PM -0600 3/16/02, Puneet Kishor wrote:
>> I have one index.pl (this is a web app), and everything passes through 
>> this. So, if the call is to index.pl?do=login then the login page is 
>> included, if the call is to index.pl?do=verify then the verify page is 
>> included. This is how I work in the world of other web programming 
>> (Cold Fusion, PHP, etc.).
>
> I've never understood why I see so much Coldfusion code doing it this 
> way.  Coming in and debugging other people's code I find it very 
> difficult to figure out what is getting executed when with this model.


I guess it is a matter of getting used to one way of doing things versus 
another. I actually find it very easy if everything goes through the one 
bottleneck of index.???. Esp. useful if I am building in extensive 
error-trapping on an application level, or if I want to change the look 
and feel of the application globally. One downside is that the URLs are 
cryptic (actually not so, since every call has a hint to what is going 
to be done via the index file, for eg, index.pl?do=getrecords or 
index.pl?do=insertrecords, etc.), but mnemonic URLs are not important in 
an application anyway.

Reply via email to