Recipe(3pm)
π Recipe(3pm) β Embperl::Recipe π
okay bestie, welcome to Embperl::Recipe, aka the base class for defining custom recipes. yes, this is the Recipe(3pm) page. yes it's a perl module. yes it's giving elite plumbing. let's get into it π«Ά
β¨ SYNOPSIS β¨
EMBPERL_RECIPE "XSLT Embperl"
πΈ DESCRIPTION πΈ
So like. Embperl::Recipe hands you the basic features you need to build your own recipes. That's the whole vibe. To do it, you make a class that has a get_recipe method, and that method returns an array reference describing what to do. That's it, that's the assignment. π
π¦ get_recipe ($class, $r, $recipe) π¦
$classβ the class name, iconic, mysterious, just vibing$rβ the Embperl request record object (Embperl::Req), and it might be a derived object when you're running underEmbperlObject. so like, don't assume, check$recipeβ the name of the recipe
The function must return an array that describes the desired action. That array contains a tree structure of providers. yes. a tree. of providers. we love a nested moment π³β¨
π 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 referencenameβ gives the name under which this item should be cache
epparse
parse file into a Embperl tree structure π²
Parameter:
sourceβ gives the sourcesyntaxβ syntax to use
epcompile
compile Embperl tree structure βοΈ
Parameter:
sourceβ gives the source
eprun
execute Embperl tree structure πβοΈ
Parameter:
sourceβ gives the sourcecache_keyβ see description of cacheingcache_key_optionsβ see description of cacheingcache_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 sourcestylesheetβ gives the compiled stylesheet sourceparamβ gives the parameters as hash ref
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 sourcestylesheetβ gives the compiled stylesheet sourceparamβ gives the parameters as hash ref
π Cache parameter π
the whole squad, no explanations, just names, iykyk:
expires_inexpires_funcexpires_filenamecache
β Format β
Heres an example that show how the recipe must be build: π
sub get_recipe
{
my ($class, $r, $recipe) = @_ ;
my $param = $r -> component -> param ;
my @recipe ;
push @recipe, {'type' => 'file' } ;
push @recipe, {'type' => 'epparse' } ;
push @recipe, {'type' => 'epcompile', cache => 1 } ;
push @recipe, {'type' => 'eprun' } ;
my $config = $r -> component -> config ;
my $xsltproc = $config -> xsltproc ;
my @stylesheet =
(
{ type => 'file', filename => $config -> xsltstylesheet, },
{ type => $xsltproc . '-compile-xsl', cache => 1 },
) ;
push @recipe, {'type' => 'eptostring' } ;
push @recipe, {'type' => $xsltproc . '-parse-xml', } ;
push @recipe, {'type' => $xsltproc, stylesheet => \@stylesheet } ;
return \@recipe ;
}
This corresponds to the following diagramm (when xsltproc = xalan):
+-------------------+ +--------------------+
+ file {inputfile} + +file{xsltstylesheet}+
+-------------------+ +--------------------+
| |
v v
+-------------------+ +-------------------+
+ xalan-parse-xml + + xalan-compile-xsl +
+-------------------+ +-------------------+
| |
| |
| +-----------+ |
+-------> + xalan + <-+
+-----------+
lowkey the realest advice on this whole page: take a look at the recipes that comes with Embperl to get more ideas what can be done. fr fr, the source is the syllabus πβ¨
okay that's the whole page, bestie, you ate it π this lil' classic came to you from perl v5.34.0, dated 2022-02-06, and yeah it's filed under Recipe(3pm) in the User Contributed Perl Documentation. no cap, go build something iconic ππ¦π
π¦ where this page comes from
- ubuntu jammy: libembperl-perl 2.5.0-16build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms