perl-announce mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <>
Subject ANNOUNCE: Embperl 2.0b4
Date Tue, 20 Nov 2001 16:49:59 GMT

has entered CPAN as

  file: $CPAN/authors/id/G/GR/GRICHTER/HTML-Embperl-2.0b4.tar.gz
  size: 507965 bytes
   md5: 03f8ca074b7588fa11ecb8002d4b50bd

Main new feature since 2.0b3 is the beginning support for XML, namely using
libxslt or Xalan to do XSLT transformations and the implementing of recipes,
which allows you to tell Embperl how to "cook" the result of a request by
pluging modules which provides different transformations together. Together
with the recipe handling the cacheing architecture has been enhanced to
properly support recipes and not only be able to cache resulting pages, but
any intermediate state.

NOTE: Embperl now use Apache::SessionX per default, see below how you can
use it with your old session config

Embperl is a system for building dynamic websites with Perl.
It gives you the power to embed Perl code in your HTML documents
and the ability to build your Web site out of small reusable objects in
an object-oriented style. You can also take advantage of all the
usual Perl modules, (including DBI for database access) use their
functionality and easily include their output in your web pages.

Embperl has several features which are especially useful for creating
HTML, including dynamic tables, form field processing, URL
escaping/unescaping, session handling, and more.

With 2.0 this feature are extented to use XML/XSLT, extent the Embperl's
syntax, build taglibs, cacheing and more.

See (english) or (german) for more information.

For a list of all changes since 2.0b3 see the end of the mail.

For all Embperl 1.x users here is a sumary of the difference of Embperl 2.0:

Hints for using Embperl 2.x


Starting with 2.0b2 Embperl files can debugged via the interavtive debugger.
The debugger shows the Embperl page source along with the correct
You can do anything you can do inside a normal Perl programm via the
e.g. show variables, modify variables, single step, set breakpoints etc.

You can use the Perl interacive command line debugger via

    perl -d file.epl

or if you prefer a graphical debugger, try ddd
it's a great tool, also for debugging any other perl script:

    ddd --debugger 'perl -d file.epl'

NOTE: could be found in the Embperl source directory

If you want to debug your pages, while running under mod_perl, Apache::DB is
right thing. Apache::DB is available from CPAN.

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

  optDisableHtmlScan can be replaced by switching the syntax e.g.

  [$syntax EmbperlBlocks $]  # same as [- $optDisableHtmlScan = 1 -]

  here goes your code, Embperl will not interpret any html tags here

  [$syntax Embperl $]        # same as [- $optDisableHtmlScan = 0 -]

- 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 brackets 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 -]

- safe namespaces

- print to OUT does not work correctly inside of loops

Embperl 1.x compatibility flag

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


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


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

Addtional Config directives

Caching parameter

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


literal string that is appended to the cache key


    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


function that should be called when build a cache key. The result is
appended to the 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.


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


Expires when the given file has changed

Syntax switching

syntax / EMBPERL_SYNTAX / [$ syntax $]

Used to tell Embperl which syntax to use inside a page. Embperl comes with
the following syntaxes:

    - EmbperlHTML       # all the HTML tag that Embperl recognizes by
    - EmbperlBlocks     # all the [ ] blocks that Embperl supports
    - Embperl           # (default; contains EmbperlHtml and EmbperlBlocks)
    - ASP               # <%  %> and <%=  %>, see perldoc
    - SSI               # Server Side Includes, see perldoc
    - Perl              # File contains pure Perl (similar to
Apache::Registry), but
                        #  can be used inside EmbperlObject
    - Text              # File contains only Text, no actions is taken on
the Text
    - Mail              # Defines the <mail:send> tag, for sending mail.
This is an
                        # example for a taglib, which could be a base for
                        # your own taglib to extent the number of available
    - POD               # translates pod files to XML, which can be
converted to
                        # the desired output format by an XSLT
    - RTF               # Can be used to process word processing documents
in RTF format

You can get a description for each syntax if you type

    perldoc HTML::Embperl::Syntax::xxx

where xxx is the name of the syntax.

You can also specify multiple syntaxes e.g.

    PerlSetEnv EMBPERL_SYNTAX "Embperl SSI"

    Execute ({inputfile => '*', syntax => 'Embperl ASP'}) ;

The syntax metacommand allows to switch the syntax or to
add or subtract syntaxes e.g.

    [$ syntax + Mail $]

will add the Mail taglib so the <mail:send> tag is available after
this line.

    [$ syntax - Mail $]

now the <mail:send> tag is unknown again

    [$ syntax SSI $]

now you can only use SSI commands inside your page.

Session handling

Session handling has changed from 1.3.3 to 1.3.4 and 2.0b3 to 2.0b4. You
must either
install Apache::SessionX or set


to get the old behaviour.


Starting with 2.0b4 Embperl introduces the concept of recipes. A recipe
tells Embperl how the request should be processed. While before 2.0b4 you
have only one processor that works on the request (the Embperl processor,
you are able to define different syntaxes), now you can have multiple of
arragend in a pipeline or even a tree. While you are able to give the full
recipe when calling Execute, this is not very convenient, so normaly you
will only give the name of a recipe, either as parameter 'recipe' to
Execute or as EMBPERL_RECIPE in your httpd.conf. Of course you can have
different recipes for different locations and/or files. A recipe is
out of providers. A provider can either be read some source or do some
processing on a source. There is no restriction what sort of data a provider
has as in- and output you just have to make sure that output format of
a provider matches the input format of the next provider. In the current
implementation Embperl comes with a set of build in providers:

- file                  read file data
- memory                get data from a scalar
- epparse               parse file into a Embperl tree structure
- epcompile             compile Embperl tree structure
- eprun                 execute Embperl tree structure
- eptostring            convert Embperl tree structure to string
- libxslt-parse-xml     parse xml source for libxslt
- libxslt-compile-xsl   parse and compile stylesheet for libxslt
- libxslt               do a xsl transformation via libxslt
- xalan-parse-xml       parse xml source for xalan
- xalan-compile-xsl     parse and compile stylesheet for xalan
- xalan                 do a xsl transformation via xalan

There is a C interface, so new custom providers can be written, but what it
make real usefull is, that the next release of Embperl will contain a
Perl interface, so you can write your own providers in Perl.

The default recipe is named Embperl and contains the following providers:

    + file      +
    + epparse   +
    + epcompile +
    + eprun     +

This cause Embperl to behave like it has done in the past, when no
recipes exists.

Each intermediate result could be cached. So for example you are able
to cache the already parsed XML or compiled stylesheet in memory,
without the need to reparse/recompile it over and over again.

Another nice thing of recipes are that they are not staticly. A recipe
is defined by a recipe object. When a request comes in Embperl calls
the new method of the recipe object, which should return a hash
that describes what Embperl has to do. The new method can of course
build the hash dynamicly, looking, for example, at the request parameters
like filename, formvalues, mime type or whatever. For example if you
give a scalar as input the Embperl recipe replaces the file provider
with a memory provider. Addtionaly you can specify more then one
recipe (spearated by spaces). Embperl will all the new methods in
turn until the first not returns undef. This way you can create recipes
that are know for what they are responsible. One possibility would be
to check the file extention and only return the recipe if it matches.
Much more sophistcated things are possible...

See perldoc HTML::Embperl::Recipe how to create your own provider.


As written above Embperl now contains provider for doing XSLT
More XML will come in the next releases. The easiest thing is to use the
stuff thru the predefined recipes:

    EmbperlLibXSLT      the result of Embperl will run thru the Gone libxslt
    EmbperlXalanXSLT    the result of Embperl will run thru Xalan-C
    EmbperlXSLT         the result of Embperl will run thru the XSL
                        given by xsltproc or EMBPERL_XSLTPROC

    LibXSLT             run source thru the Gone libxslt
    XalanXSLT           run source thru Xalan-C
    XSLT                run source thru the XSL transformer given by
xsltproc or

For example including the result of an XSLT
transformation into your html page could look like this:

    <html><head><title>Include XML via XSLT</title></head>

    <h1>Start xml</h1>
    [- Execute ({inputfile => 'foo.xml', recipe => 'EmbperlXalanXSLT',
xsltstylesheet => 'foo.xsl'}) ; -]


As you already guess the xsltstylesheet parameter gives the name of the xsl
file. You can also use the EMBPERL_XSLTSTYLESHEET configuration directive
to set it from your configuration file.

By setting EMBPERL_ESCMODE (or $escmode) to 15 you get the correct escaping
for XML.


Changes since 2.0b3:

   - Enhancements for RTF syntax, allowing no IF fields and passes
     thru any unkown fields.
   - Fixed problem when loading syntax. Spotted by Michael Stevens.
   - Allow Perl code inside of HTML attributes in ASP syntax, together with
     EmbperlHTML syntax. Spotted by Ivan G. Shevchenko.
   - Added POD syntax, which converts POD to XML, which can transformed to
     any other output format using XSLT.
   - Enhanced Makefile.PL to support plugins for linking of extra libraries.
   - Added support for libxslt
   - Added support for Xalan-C XSLT
   - Added the concept of recipes which allows to dynamicly tell Embperl
     how to process a request. A recipe is basicly a tree structure
     with put different providers together. Every provider can act
     upon the output of the preceeding providers. See README.v2
     and perldoc HTML::Embperl::Recipe for more details.
   - Added new configuration directive EMBPERL_RECIPE/Execute parameter
     recipe, which tells Embperl how a file should be processed.
   - Added recipes for XSLT transformation.
   - Rebuild cache management to work together with recipes. Now every
     intermediate step could be cached.
   - Add new debug flags dbgOutput, dbgRun, dbgCache, dbgCompile, dbgXML,
     dbgXSLT, dbgCheckpoint, dbgDOM to have a more fine control what's
     going into the log file
   - Changes in Embperl's internal tree representation, to fix serveral
     small problems and in preparation for proper XML handling.
   - print OUT inside loop works now correctly
   - Added new escmode 8/15 which generates correct XML escaping.
   - $row_foo will no longer treated as $row. Bug reported by Dave Fischer.
   - Add patch from Wim Kerkhoff so SSI syntax works together with
     EmbperlObject, i.e. included files are searched in the same way as
     normal Embperl files.
   - Add new method AddTagInside in HTML::Embperl::Syntax::HTML to allow
     tags inside of other tags.

 - Added method $r -> Espace for html & url escaping
   - URL escpage # to %23
   - use Content-Lenght HTTP Header instead of $ENV{CONTENT_LENGTH}
     when running under mod_perl and win32. This fixes a bug
     with POSTed data reported by Lukas Zapletal.
   - Display correct Apache module name in Makefile.PL when
     requesting path for Apache module. Patch from James Lee.
   - New session handling using Apache::SessionX. (This also
     fixes problem with MD5 and Perl 5.6.1)
   - Fixed a bug that cause file-uploads to fail for the first
     request to a file when running under EmbperlObject. Reported
     by Thoren Johne.
   - Make sure the HTML::Embperl::Mail generates correct line endings
   - If Perl's STDOUT and/or STDIN are tied to any package, Embperl now
     calls the Perl methods PRINT and READ for doing I/O. This currently
     only works, when not running under mod_perl.
   - Embperl can now run under FastCGI. Use instead of
   - Delete unnecessary PerlFixupHandler from httpd.conf.src for make test.
     Reported by David Merberg.
   - Add undef to %idat for select tag with nothing selected if
     optAllFormdata is set.
   - Cleanup of DBIx::Recordset objects now honors the setting in %CLEANUP.
     Problem reported by Kee Hinckley.
   - Embperl can now use encrypted sourcefiles. See crypto/README for
   - Embperl can now be installed as Apache and non Apache version on the
     same system. This is neccessary to work on Windows in- and outside of
   - Fixed a linkage problem with symbol embperl_module, first reported
     by GustavKristoffer Ek.
   - error message now always contain a filename.
   - Added optShowBacktrace to enable backtrace of filename in error
   - Removed obsolete debug flags dbgDisableCache, dbgWatchScalar,



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

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:         Voice:    +49 6133 925131
WWW:      Fax:      +49 6133 925152

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message