.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Recipe 3pm" .TH Recipe 3pm "2020-11-09" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Embperl::Recipe \- base class for defining custom recipes .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& EMBPERL_RECIPE "XSLT Embperl" .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" 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 \f(CW\*(C`get_recipe\*(C'\fR method which returns a array reference that contains the description what to do. .ie n .SS "get_recipe ($class, $r, $recipe)" .el .SS "get_recipe ($class, \f(CW$r\fP, \f(CW$recipe\fP)" .IX Subsection "get_recipe ($class, $r, $recipe)" .ie n .IP "$class" 4 .el .IP "\f(CW$class\fR" 4 .IX Item "$class" The class name .ie n .IP "$r" 4 .el .IP "\f(CW$r\fR" 4 .IX Item "$r" The Embperl request record object (Embperl::Req), maybe a derived object when running under EmbperlObject. .ie n .IP "$recipe" 4 .el .IP "\f(CW$recipe\fR" 4 .IX Item "$recipe" The name of the recipe .PP The function must return an array that describes the desired action. The array contains a tree structure of providers. .SS "Providers" .IX Subsection "Providers" .IP "file" 4 .IX Item "file" read file data .Sp Parameter: .RS 4 .IP "filename" 4 .IX Item "filename" Gives the file to read .RE .RS 4 .RE .IP "memory" 4 .IX Item "memory" get data from a scalar .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the source as a scalar reference .IP "name" 4 .IX Item "name" Gives the name under which this item should be cache .RE .RS 4 .RE .IP "epparse" 4 .IX Item "epparse" parse file into a Embperl tree structure .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the source .IP "syntax" 4 .IX Item "syntax" Syntax to use .RE .RS 4 .RE .IP "epcompile" 4 .IX Item "epcompile" compile Embperl tree structure .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the source .RE .RS 4 .RE .IP "eprun" 4 .IX Item "eprun" execute Embperl tree structure .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the source .IP "cache_key" 4 .IX Item "cache_key" See description of cacheing .IP "cache_key_options" 4 .IX Item "cache_key_options" See description of cacheing .IP "cache_key_func" 4 .IX Item "cache_key_func" See description of cacheing .RE .RS 4 .RE .IP "eptostring" 4 .IX Item "eptostring" convert Embperl tree structure to string .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the source .RE .RS 4 .RE .IP "libxslt-parse-xml" 4 .IX Item "libxslt-parse-xml" parse xml source for libxslt .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the xml source .RE .RS 4 .RE .IP "libxslt-compile-xsl" 4 .IX Item "libxslt-compile-xsl" parse and compile stylesheet for libxslt .Sp Parameter: .RS 4 .IP "stylesheet" 4 .IX Item "stylesheet" Gives the stylesheet source .RE .RS 4 .RE .IP "libxslt" 4 .IX Item "libxslt" do a xsl transformation via libxslt .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the parsed xml source .IP "stylesheet" 4 .IX Item "stylesheet" Gives the compiled stylesheet source .IP "param" 4 .IX Item "param" Gives the parameters as hash ref .RE .RS 4 .RE .IP "xalan-parse-xml" 4 .IX Item "xalan-parse-xml" parse xml source for xalan .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the xml source .RE .RS 4 .RE .IP "xalan-compile-xsl" 4 .IX Item "xalan-compile-xsl" parse and compile stylesheet for xalan .Sp Parameter: .RS 4 .IP "stylesheet" 4 .IX Item "stylesheet" Gives the stylesheet source .RE .RS 4 .RE .IP "xalan" 4 .IX Item "xalan" do a xsl transformation via xalan .Sp Parameter: .RS 4 .IP "source" 4 .IX Item "source" Gives the parsed xml source .IP "stylesheet" 4 .IX Item "stylesheet" Gives the compiled stylesheet source .IP "param" 4 .IX Item "param" Gives the parameters as hash ref .RE .RS 4 .RE .SS "Cache parameter" .IX Subsection "Cache parameter" .IP "expires_in" 4 .IX Item "expires_in" .PD 0 .IP "expires_func" 4 .IX Item "expires_func" .IP "expires_filename" 4 .IX Item "expires_filename" .IP "cache" 4 .IX Item "cache" .PD .SS "Format" .IX Subsection "Format" Heres an example that show how the recipe must be build: .PP .Vb 1 \& sub get_recipe \& \& { \& my ($class, $r, $recipe) = @_ ; \& \& my $param = $r \-> component \-> param ; \& my @recipe ; \& \& push @recipe, {\*(Aqtype\*(Aq => \*(Aqfile\*(Aq } ; \& push @recipe, {\*(Aqtype\*(Aq => \*(Aqepparse\*(Aq } ; \& push @recipe, {\*(Aqtype\*(Aq => \*(Aqepcompile\*(Aq, cache => 1 } ; \& push @recipe, {\*(Aqtype\*(Aq => \*(Aqeprun\*(Aq } ; \& \& my $config = $r \-> component \-> config ; \& my $xsltproc = $config \-> xsltproc ; \& \& my @stylesheet = \& ( \& { type => \*(Aqfile\*(Aq, filename => $config \-> xsltstylesheet, }, \& { type => $xsltproc . \*(Aq\-compile\-xsl\*(Aq, cache => 1 }, \& ) ; \& \& \& push @recipe, {\*(Aqtype\*(Aq => \*(Aqeptostring\*(Aq } ; \& push @recipe, {\*(Aqtype\*(Aq => $xsltproc . \*(Aq\-parse\-xml\*(Aq, } ; \& push @recipe, {\*(Aqtype\*(Aq => $xsltproc, stylesheet => \e@stylesheet } ; \& \& return \e@recipe ; \& } .Ve .PP This corresponds to the following diagramm (when xsltproc = xalan): .PP .Vb 10 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& + file {inputfile} + +file{xsltstylesheet}+ \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& | | \& v v \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& + xalan\-parse\-xml + + xalan\-compile\-xsl + \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& | | \& | | \& | +\-\-\-\-\-\-\-\-\-\-\-+ | \& +\-\-\-\-\-\-\-> + xalan + <\-+ \& +\-\-\-\-\-\-\-\-\-\-\-+ .Ve .PP Take a look at the recipes that comes with Embperl to get more ideas what can be done.