NAME

Embperl base class for defining custom recipes

SYNOPSIS

PerlSetEnv EMBPERL_RECIPE "XSLT Embperl"

DESCRIPTION

HTML::Embperl::Recipe provides basic features that are necessary for createing your own recipes. To do so you have to create a class that provides a new method which returns a hash that contains the description what to do.

new ($class, $r, $recipe, $param)

$class

The class name

$r

The Embperl request record object (HTML::Embperl::Req), maybe a derived object when running under EmbperlObject.

$recipe

The name of the recipe

$param

The parameters the user passed to Execute.

The function must return a hash that describes the desired action. The hash contains a tree structure of providers.

Providers

file

read file data

Parameter:

filename

Gives the file to read

memory

get data from a scalar

Parameter:

source

Gives the source as a scalar reference

name

Gives the name under which this item should be cache

epparse

parse file into a Embperl tree structure

Parameter:

source

Gives the source

syntax

Syntax to use

epcompile

compile Embperl tree structure

Parameter:

source

Gives the source

eprun

execute Embperl tree structure

Parameter:

source

Gives the source

cache_key

See description of cacheing

cache_key_options

See description of cacheing

cache_key_func

See description of cacheing

eptostring

convert Embperl tree structure to string

Parameter:

source

Gives the source

libxslt-parse-xml

parse xml source for libxslt

Parameter:

source

Gives the xml source

libxslt-compile-xsl

parse and compile stylesheet for libxslt

Parameter:

stylesheet

Gives the stylesheet source

libxslt

do a xsl transformation via libxslt

Parameter:

source

Gives the parsed xml source

stylesheet

Gives the compiled stylesheet source

xalan-parse-xml

parse xml source for xalan

Parameter:

source

Gives the xml source

xalan-compile-xsl

parse and compile stylesheet for xalan

Parameter:

stylesheet

Gives the stylesheet source

xalan

do a xsl transformation via xalan

Parameter:

source

Gives the parsed xml source

stylesheet

Gives the compiled stylesheet source

Cache parameter

expires_in
expires_func
expires_filename
cache

Format

Heres an example that show how the hash must be build:

sub new
  {
  my ($class, $r, $recipe, $param) = @_ ;

  my $self =
      {
      'provider' => 
          {
          'type' => 'xalan',
          'source' => 
              {
              'cache'    => 0,
              provider =>
                  {
                  'type'      =>  'xalan-parse-xml',
                  'source' =>
                      {
                     'cache' => 0,
                      provider => 
                          {
                          'type'      =>  'file',
                          'filename'  => $param -> {inputfile},
                          }
                      },
                  },
              },
          'stylesheet' => 
              {
              'cache'    => 1,
              provider =>
                  {
                  'type'      =>  'xalan-compile-xsl',
                  'stylesheet' =>
                      {
                      'cache'    => 0,
                      provider =>
                          {
                          'type'      =>  'file',
                          'filename'  => $param -> {xsltstylesheet},
                          }
                      },
                  },
              }
          }
      } ;

  return $self ;
  }

This corresponds to the following diagramm:

+-------------------+   +--------------------+           
+ file {inputfile}  +   +file{xsltstylesheet}+           
+-------------------+   +--------------------+           
      |                         |                         
      v                         v                         
+-------------------+   +-------------------+           
+ xalan-parse-xml   +   + xalan-compile-xsl +           
+-------------------+   +-------------------+           
      |                         | 
      |                         |
      |         +-----------+   |
      +-------> + xalan     + <-+
                +-----------+

Take a look at the recipes that comes with Embperl to get more ideas what can be done.