Mailing List Archive

ANNOUNCE: Embperl 2.0b1
After long time of talking, designing, developing, codeing and testing I am
now happy to announce the first beta of Embperl 2.0. It has a totaly
rewritten core and makes the way free for a lot of new possibilities...

At the moment it's mainly a speed improvement and introduces caching of the
(component) output. In the next releases I successively make the
possibilities of this new architecture available. (see the readme below for
some ideas what will happen).

Since it's not yet ready for production use, it's only available from my ftp
server at

ftp://ftp.dev.ecos.de/pub/perl/embperl/HTML-Embperl-2.0b1.tar.gz

Enjoy

Gerald

README.v2:
==========

Embperl 2 has a totaly rewritten core. It contains nearly 7500 lines
new (mostly C-) code. Also I have done a lot of testing, don't expect
it to work without errors!

Please report any weired behaviour to the embperl mailing list, but
be sure to read this whole README to understand what can't work so far.

The Embperl core now works in a totaly different way. It is divided into
smaller steps:

1 reading the source
2 parseing
3 compiling
4 executing
5 outputing

Further version will allow to replace every single step of this pipeline
with custom modules. Also it will be possible to cascade multiple
processors. This allows for example to have Embperl and SSI in one file
and to parse the file only once, feeding it first to the SSI processor and
afterwards to the Embperl processor. Also the parser will be exchangeable
in future version to allow for example to use an XML parser and an
XSLT stylesheet processor.

These new execution scheme is also faster, because html tags and
metacommands
are parsed only once (Perl code was also (and is still) cached in 1.x)
My first benchmarks show 50%-100% faster execution under mod_perl for pages
longer then 20K (For short pages ( < 5K ouput) you won't see such a great
difference)
and without any external database access.

Another new feature is that the syntax of the Embperl parser is defined
within the module HTML::Embperl::Syntax and can be modified as nessecary.
See the file Embperl/Syntax.pm how it looks like and

perldoc HTML::Embperl::Syntax

for a short description. A further verion will add an API to this syntax
module,
so custom syntaxes can be easily added, without modifiy Syntax.pm itself.

Also new is the possibility to cache (parts of) the output.


The following difference to Embperl 1.x apply:
------------------------------------------------------

- The following options can currently only set from the httpd.conf:
optRawInput, optKeepSpaces

- The following options are currently not supported:
optDisableHtmlScan, optDisableTableScan,
optDisableInputScan, optDisableMetaScan

- Nesting must be properly. I.e. you cannot put a <table> tag (for an
dynamic table) inside an if and the </table> inside another if.
(That still works for static tables)

- optUndefToEmptyValue is always set and cannot be disabled.

- [$ foreach $x (@x) $] requires now the bracket around the
array (like Perl)

- [+ +] blocks must now contain a valid Perl expression. Embperl 1.x
allows you to put multiple statements into such a block. For performance
reasons this is not possible anymore. Also the expression must _not_
terminated with a semikolon. To let old code work, just wrap it into a do
e.g. [.+ do { my $a = $b + 5 ; $a } +]


The following things are not fully tested/working yet:
------------------------------------------------------

- [- exit -]

- [- print OUT "foo" -]

- safe namespaces


Embperl 1.x compatibility flag
------------------------------

If you don't have a separate computer to make the test setup, you can
include

PerlSetEnv EMBPERL_EP1COMPAT 1

at the top level of your httpd.conf, then Embperl will behave just the same
like Embperl 1.3b7. In the directories where you make your tests, you
include a

PerlSetEnv EMBPERL_EP1COMPAT 0

to enable the new engine.

but _DON'T_ use this one a production machine. While this compatibility mode
is tested and shows no problems for me, it's not so hard tested as 1.3b7
itself!


Addtional Config directives
---------------------------

execute parameter / httpd.conf environment variable / name inside page (must
set inside [! !])


cache_key / EMBPERL_CACHE_KEY / $CACHE_KEY

literal string that is appended to the cache key


cache_key_options / EMBPERL_CACHE_KEY_OPTIONS / $CACHE_KEY_OPTIONS

ckoptCarryOver = 1, use result from CacheKeyFunc of preivious step
if any
ckoptPathInfo = 2, include the PathInfo into CacheKey
ckoptQueryInfo = 4, include the QueryInfo into CacheKey
ckoptDontCachePost = 8, don't cache POST requests (not yet implemented)

Default: all options set


expired_func / EMBPERL_EXPIRES_FUNC / &EXPIRES

function that should be called when build a cache key. The result is
appended to the cache key.


cache_key_func / EMBPERL_CACHE_KEY_FUNC / &CACHE_KEY

function that is called everytime before data is taken from the cache.
If this funtion returns true, the data from the cache isn't used anymore,
but rebuild.


Function could be either a coderef (when passed to Execute), a name of a
subroutine or a string starting with "sub " in which case it is compiled
as anoymous subroutine.


expires_in / EMBPERL_EXPIRES_IN / $EXPIRES

Time in seconds that the output schould be cached. (0 = never, -1 = forever)





-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------