> I am working on a website which is using ePerl for embedding Perl code
> in HTML. Due to various reasons I am contemplating migrating to EmbPerl
> or Mason. The problem is that in ePerl all code are delimited by <% ....
> %> but in EmbPerl I see [- / [+ / [* and other delimiters. I could
> obviously sit and rework the whole site but that is a uphill task and
> prone to errors espcially since there doesn't seem to be a one to one
> mapping.
Do you have any references to ePerl which we could use to look at the
differences? I have heard about this, but never seen it.
> 1. A cursory glance tells me replacing <% with [* and %> with *] should
> solve most of my problems - is this approach correct - [* is in a
> experimental stage, performance issues maybe ??
EmbPerl is an encapsulation of Perl, with some additional metatags and
wrappers which make the marriage with HTML and execution in a Web server
context more palatable. Most, if not all of the meta tags in EmbPerl work
in similar ways to the pure Perl (e.g. [$ while $], [$ if $] etc)
I don't know if there are any performance issues with [*, I believe it was
introduced because whereas every [- block has its own scope, [* blocks
share scope across the entire page. All [* does is allow you to declare
local variables which are local to the entire page (i.e. across different
[* blocks). Also, if you want to do recursion using Execute() then it is
useful. Finally, [* allows you to spread native Perl control structures
across different [* blocks. Having said this, I happen to use [- almost
everywhere.
As usual, it's the small and subtle differences which make any major
project conversion difficult. You are going to have to go through all your
code by hand regardless of what you choose. For example, the Execute()
function is rich and has some subtleties. But it is most useful as an
'include' function, allowing you to split your website into modules. The
EmbperlObject feature takes this even further, allowing you to make your
website almost object oriented in structure, with directories and
subdirectories able to override HTML modules in higher directories. This is
extremely powerful.
> 2. A basic question - why do we have so many types of delimitter - I
> know they are serving different purposes but still why would we want to
> differentiate??
I am speaking for myself here, Gerald (the author) is on vacation but I can
give my view of it:
The different delimiters are for reasons of both performance and
convenience. For example, sometimes you want to just execute some Perl code
in the HTML, without there being anything output. Then you would use [-.
Frequently however, you want to include a variable or the result of some
expression in the output HTML. Then you would use [+. Yet other times you
may want to declare some sub routines, and for performance reasons you
really only want to do this once. Then you use [!. You can see that the
different delimiters give different contexts to the Perl code, which have
the effect of either increasing performance or providing more convenience
in expressing what we frequently need to do.
If it's any help, I was completely new to Perl and EmbPerl about a year
ago. Prior to that I had around 10 years of heavy C++ experience. My view
currently is that I absolutely love Perl, and EmbPerl is a wonderful way to
implement websites using mod_perl and Apache. EmbPerl is a very practical
and elegant solution, it is free and open, and it is under active
development. I chose it over other solutions (such as Mason and PHP)
because it seemed the most transparent in the way it allowed the blending
of an existing powerful language (Perl) and HTML.
Hope this is useful
-Neil Gunton
NilSpace Inc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]