Petal(3pm)
π Petal(3pm) π β Perl Template Attribute Language, TAL for Perl! β¨
okay bestie, this is the User Contributed Perl Documentation moment for Petal(3pm). Buckle up, we're doing TAL for Perl and it's giving WYSIWYG magic. π¦
β¨ NAME β¨
Petal β Perl Template Attribute Language β TAL for Perl! π
πΈ SYNOPSIS πΈ
in your Perl code:
use Petal;
my $template = new Petal ('foo.xhtml');
print $template->process (bar => 'BAZ');
in foo.xhtml
<html xmlns:tal="http://purl.org/petal/1.0/">
<body tal:content="bar">Dummy Content</body>
</html>
and you get something like:
<html>
<body>BAZ</body>
</html>
π« SUMMARY π«
Petal is a XML based templating engine that is able to process any kind of XML, XHTML and HTML. no cap
Petal borrows a lot of good ideas from the Zope Page Templates TAL specification, it is very well suited for the creation of WYSIWYG XHTML editable templates. iconic
The idea is to further enforce the separation of logic from presentation. With Petal, graphic designers can use their favorite WYSIWYG editor to easily edit templates without having to worry about the loops and ifs which happen behind the scene. main character energy for designers tbh
π§ NAMESPACE π§
Although this is not mandatory, Petal templates should include use the namespace <http://purl.org/petal/1.0/>. Example:
<html xml:lang="en"
lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://purl.org/petal/1.0/">
Blah blah blah...
Content of the file
More blah blah...
</html>
If you do not specify the namespace, Petal will by default try to use the "petal:" prefix. However, in all the examples of this POD we'll use the "tal:" prefix to avoid too much typing. iykyk
π₯ KICKSTART π₯
Let's say you have the following Perl code:
use Petal;
local $Petal::OUTPUT = 'XHTML';
my $template = new Petal ('foo.xhtml');
$template->process ( my_var => some_object() );
some_object() is a subroutine that returns some kind of object, may it be a scalar, object, array referebce or hash reference. Let's see what we can do... the possibilities are endless bestie
π Version 1: WYSIWYG friendly prototype.
Using TAL you can do:
This is the variable 'my_var' :
<span tal:replace="my_var/hello_world">Hola, Mundo!</span>
Now you can open your template in any WYSIWYG tool (mozilla composer, frontpage, dreamweaver, adobe golive...) and work with less risk of damaging your petal commands. slay
π¦ Version 2: Object-oriented version
Let's now say that "my_var" is actually an object with a method hello_world() that returns Hello World. To output the same result, your line, which was:
<span tal:replace="my_var/hello_world">Hola, Mundo!</span>
Would need to be... EXACTLY the same. Petal lets you access hashes and objects in an entirely transparent way and tries to automagically do The Right Thing for you. the way that it just works
This high level of polymorphism means that in most cases you can maintain your code, swap hashes for objects, and not change a single line of your template code. periodt
π Version 3: Personalizable
Now let's say that your method hello_world() can take an optional argument so that "$some_object->hello_world ('Jack')" returns Hello Jack.
You would write:
<span tal:replace="my_var/hello_world 'Jack'">Hola, Mundo!</span>
Optionally, you can get rid of the quotes by using two dashes, a la GNU command-line option:
<span tal:replace="my_var/hello_world --Jack">Hola, Mundo!</span>
So you can pass parameters to methods using double dashes or quotes. Now let us say that your "my_var" object also has a method current_user() that returns the current user real name. You can do:
<span tal:replace="my_var/hello_world my_var/current_user">Hola, Mundo!</span>
TRAP: You cannot write nested expressions such as: html ${my_var/hello_world ${my_var/current_user}} This will NOT work. At least, not yet. crying
π Version 4: Internationalized
Let's say that you have a directory called "hello_world" with the following files:
hello_world/en.xhtml
hello_world/fr.xhtml
hello_world/es.xhtml
You can use Petal as follows in your Perl code:
use Petal;
local $Petal::OUTPUT = 'XHTML';
my $template = new Petal ( file => 'hello_world', lang => 'fr-CA' );
print $template->process ( my_var => some_object() );
What will happen is that the $template object will look in the "hello_world" directory and try to find a file named "fr-CA.xhtml", then "fr.xhtml", then will default to "en.xhtml". It works fine for includes, too! inclusive king
These internationalized templates can have whatever file-extension you like, Petal searches on the first part of the filename. So you can call them "fr.html", "fr.xml", "fr.xhtml" or use whatever convention suits you. freedom
NOTE: There is now support for ZPT-like i18n attributes, which should provide a much nicer framework. See Petal::I18N for details. go read it bestie
TIP: If you feel that'en'should not be the default language, you can specify a different default:perl my $template = new Petal ( file => 'hello_world', language => 'zh', default_language => 'fr' # vive la France! );
TRAP: If you do specify the"lang"option, you MUST use a path to a template directory, not a file directory. Conversely, if you do not specify a"lang"option, you MUST use a path to a template file, not a directory. do not ignore this
β¨ OPTIONS β¨
When you create a Petal template object you can specify various options using name => value pairs as arguments to the constructor. For example:
my $template = Petal->new(
file => 'gerbils.html',
base_dir => '/var/www/petshop',
input => 'HTML',
output => 'HTML',
);
The recognized options are:
file => filenameβ The template filename. This option is mandatory and has no default. mandatory means mandatory bestie Note: If you also use'language'this option should point to a directory.base_dir => pathname | [ pathname list ](default:'.') β The directories listed in this option will be searched in turn to locate the template file. A single directory can be specified as a scalar. For a directory list use an arrayref. arrayref, not a vibeinput => 'HTML' | 'XHTML' | 'XML'(default:'XML') β Defines the format of the template files. Recognised values are:
'HTML' - Alias for 'XHTML'
'XHTML' - Petal will use Petal::Parser to parse the template
'XML' - Petal will use Petal::Parser to parse the template
output => 'HTML' | 'XHTML' | 'XML'(default:'XML') β Defines the format of the data generated as a result of processing the template files. Recognised values are:
'HTML' - Petal will output XHTML, self-closing certain tags
'XHTML' - Alias for 'HTML'
'XML' - Petal will output generic XML
language => language codeβ For internationalized applications, you can use the'file'option to point to a directory and select a language-specific template within that directory using the'language'option. Languages are selected using a two letter code (eg:'fr') optionally followed by a hyphen and a two letter country code (eg:'fr-CA'). bonjourdefault_language => language code(default:'en') β This language code will be used if no template matches the selected language-country or language.taint => true | false(default:false) β If set to"true", makes perl taint mode happy. taint mode self-careerror_on_undef_var => true | false(default:true) β If set to"true", Petal willconfess()errors when trying to access undefined template variables, otherwise an empty string will be returned. confess() is dramatic and validerror_on_include_error => true | false(default:false) β If set to"true", Petal willconfess()errors when trying render includes.disk_cache => true | false(default:true) β If set to"false", Petal will not use the"Petal::Cache::Disk"module. cache girliememory_cache => true | false(default:true) β If set to"false", Petal will not use the"Petal::Cache::Memory"module. cache girlie pt 2cache_only => true | false(default:false) β If set to"true", Petal will return true after having compiled a template into perl code and a subroutine , and optionally using disk_cache or memory_cache if either is set.max_includes => number(default:30) β The maximum number of recursive includes before Petal stops processing. This is to guard against accidental infinite recursions. no infinite loop eradebug_dump => true | false(default:true) β If this option is true, when Petal cannot process a template it will output lots of debugging information in a temporary file which you can inspect. The location for this file is whereverFile::Spec->tmpdir()specifies as a temp directory (usually/tmpon a unix system). debug teaencode_charset => charset(default:undef) β This option is _DEPRECATED_ as of Petal 2.01. Petal will now always return results in Perl's internal form. DEPRECATED bestie, read the room It doesn't guarantee that the result will be in UTF-8 or in your local encoding, but at least the UTF-8 flag should be set properly. If you want to encode the results for a specific charset, you should look at the moduleEncode.decode_charset => charset(default:undef) β This option will work only if you use Perl 5.8 or greater. Perl 5.8+ only, check your version If specified, Petal will assume that the template to be processed (and its sub-templates) are in the character set charset.charsetcan be any character set that can be used with the moduleEncode.
πΈ TAL SYNTAX πΈ
okay so bestie, this whole thing is directly and shamelessly stolen from the absolutely excellent TAL spec β like, we are not even pretending otherwise π β and the source is here: <http://wiki.zope.org/ZPT/TAL>.
π define π
Abstract
<tag tal:define="variable_name EXPRESSION">
It evaluates EXPRESSION and hands the returned value over to variable_name. cute, right?
Example
<!--? sets document/title to 'title' -->
<span tal:define="title document/title">
Why?
This one is a lifesaver when you're stuck with a very/very/long/expression. You can just set it to, let's say, vvle, and then use vvle everywhere instead of typing out very/very/long/expression over and over. obsessed with the convenience honestly. β¨
π condition (ifs) π
Abstract
<tag tal:condition="true:EXPRESSION">
blah blah blah
</tag>
Example
<span tal:condition="true:user/is_authenticated">
Yo, authenticated!
</span>
Why?
Conditions let you display something only if an expression is true. They're also the move when you need to check that a list actually exists before you try to loop through it β because looping through a thing that isn't there? not the vibe. π
π¦ repeat (loops) π¦
Abstract
<tag tal:repeat="element_name EXPRESSION">
blah blah blah
</tag>
Why?
Repeat statements loop through a list of values β typically so you can display all the resulting records of a database query. very demure, very mindless, very efficient. π
Example:
<li tal:repeat="user system/user_list">$user/real_name</li>
A select list with one item selected:
<select>
<option
selected="selected"
tal:attributes="value self/selected_lang/value"
tal:content="self/selected_lang/label"
>English</option>
<option
value="i-klingon"
tal:repeat="lang self/unselected_langs;"
tal:attributes="value lang/value"
tal:content="lang/label"
>Klingon</option>
</select>
A table with rows of alternating colours set via CSS:
<table>
<div
tal:omit-tag=""
tal:repeat="audience self/audiences"
>
<tr
class="odd"
tal:condition="repeat/odd"
>
<td>
This a odd row, it comes before the even row.
</td>
</tr>
<tr
class="even"
tal:condition="repeat/even"
>
<td>
This a even row.
</td>
</tr>
</div>
</table>
Now, repeat is a local temporary object that only exists inside a petal:repeat loop. It's got a whole little squad of methods for picking out different positions in the loop:
repeat/index
index returns the numeric position of this item within the loop, and it starts with one, not zero. (yes, one. not zero. I know.)
repeat/number
number is an alias for index.
repeat/even
even is true if the position is even (0, 2, 4 ...)
repeat/odd
odd is true is the position is odd (1, 3, 5 ...)
repeat/start
start is true if this is the first item.
repeat/end
end is true if this is the last item.
repeat/inner
inner is true if this is not the start or end.
β attributes β
Abstract
<tag tal:attributes="attr1 EXPRESSION_1; attr2 EXPRESSION_2"; ...">
blah blah blah
</tag>
Example
<a href="http://www.gianthard.com"
lang="en-gb"
tal:attributes="href document/href_relative; lang document/lang">
Why?
Attributes statements let you template a tag's attributes. that's it, that's the whole thing, and it slays.
π content π
Abstract
<tag tal:content="EXPRESSION">Dummy Data To Replace With EXPRESSION</tag>
By default, the characters greater than, lesser than, double quote and ampersand get encoded to the entities <, >, " and & respectively. If you don't want that to happen β because the result of your expression is already encoded β then you have to use the structure keyword.
Example
<span tal:content="title">Dummy Title</span>
<span tal:content="structure some/variable">
blah blah blah
</span>
Why?
It lets you replace the contents of a tag with whatever value the evaluation of EXPRESSION returned. And this is lowkey handy because you can fill your templates with dummy content, which makes them actually usable inside a WYSIWYG tool. π
π replace π
Abstract
<tag tal:replace="EXPRESSION">
This time the entire tag is replaced
rather than just the content!
</tag>
Example
<span tal:replace="title">Dummy Title</span>
Why?
Similar reasons to content. BUT β and this is important bestie, pay attention β note that tal:content and tal:replace are *NOT* aliases. The former replaces the contents of the tag, while the latter replaces the whole entire tag.
And fr fr, you cannot use tal:content and tal:replace in the same tag. just don't. π
πΈ omit-tag πΈ
Abstract
<tag tal:omit-tag="EXPRESSION">Some contents</tag>
Example
<b tal:omit-tag="not:bold">I may not be bold.</b>
If not:bold is evaluated as TRUE, then the <b> tag gets omited. If not:bold is evaluated as FALSE, then the <b> tag stays right where it is.
Why?
omit-tag statements let you leave the contents of a tag in place while omitting the surrounding start and end tags β but only if the expression being evaluated is TRUE.
TIP:
If you want to ALWAYS remove a tag, you can use omit-tag="string:1" π
π on-error π
Warning: this is currently only partially implemented. on-error may be used in Petal templates, but the expression isn't evaluated β Petal simply prints the expression as a string.
Abstract
<tag on-error="EXPRESSION">...</tag>
Example
<p on-error="string:Cannot access object/method!!">
$object/method
</p>
Why?
When Petal runs into an error, it usually just dies with some obscure error message. The on-error statement lets you trap that error and swap it out for a proper error message. much more civilised honestly.
π§ using multiple statements π§
You can do things like:
<p tal:define="children document/children"
tal:condition="children"
tal:repeat="child children"
tal:attributes="lang child/lang; xml:lang child/lang"
tal:content="child/data"
tal:on-error="string:Ouch!">Some Dummy Content</p>
Given the fact that XML attributes are not ordered, within the same tag statements will be executed in the following order:
define
condition
repeat
attributes
content
OR
replace
OR
omit-tag
content
TRAP:
Don't forget that the default prefix is petal: NOT tal: β until you set the petal namespace in your HTML or XML document like this:
<html xmlns:tal="http://purl.org/petal/1.0/">
π METAL MACROS π
Petal supports an implementation of the METAL specification, which is a very WYSIWYG-compatible way of doing template includes. β¨
π define-macro π
In order to define a macro inside a file (i.e. a fragment to be included), you use the metal:define-macro directive. For example:
File foo.xml
============
<html xmlns:metal="http://xml.zope.org/namespaces/metal">
<body>
<p metal:define-macro="footer">
(c) Me (r)(tm) (pouet pouet)
</p>
</body>
</html>
π use-macro π
In order to use a previously defined macro, you use the metal:use-macro directive. For example:
File bar.xml
============
<html xmlns:metal="http://xml.zope.org/namespaces/metal">
<body>
... plenty of content ...
<p metal:use-macro="foo.xml#footer">
Page Footer.
</p>
</body>
</html>
π¦ define-slot π¦
In any given macro you can define slots, which are bits of macros that can be overridden by something else using the fill-macro directive. To re-use the example above, imagine that we want to be able to optionally override the (pouet pouet) bit with something else:
File foo.xml
============
<html xmlns:metal="http://xml.zope.org/namespaces/metal">
<body>
<p metal:define-macro="footer">
(c) Me (r)(tm) <span metal:define-slot="pouet">(pouet pouet)</span>
</p>
</body>
</html>
π fill-slot π
Your including file can override any slot using the fill-slot instruction, i.e.
File bar.xml
============
<html xmlns:metal="http://xml.zope.org/namespaces/metal">
<body>
... plenty of content ...
<p metal:use-macro="foo.xml#footer">
Page Footer. <span metal:fill-slot="pouet" petal:omit-tag="">(bar baz)</span>
</p>
</body>
</html>
This would result in the macro foo.xml#footer to produce:
<html>
<body>
<p>
(c) Me (r)(tm) (bar baz)
</p>
</body>
</html>
β self includes β
In Zope, METAL macros are expanded first, and then the TAL instructions are processed. However with Petal, METAL macros are expanded at run-time just like regular includes, which allows for recursive macros. iconic behaviour honestly.
This example templates a sitemap, which on a hierarchically organized site would be recursive by nature:
<html xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:petal="http://purl.org/petal/1.0/">
<body>
<p>Sitemap:</p>
<li metal:define-macro="recurse">
<a href="#"
petal:attributes="href child/Full_Path"
petal:content="child/Title"
>Child Document Title</a>
<ul
petal:define="children child/Children"
petal:condition="children"
petal:repeat="child children"
>
<li metal:use-macro="#recurse">Dummy Child 1</li>
<li petal:replace="nothing">Dummy Child 2</li>
<li petal:replace="nothing">Dummy Child 3</li>
</ul>
</li>
</body>
</html>
β¨ EXPRESSIONS AND MODIFIERS β¨
Okay bestie, so Petal can bind your template variables to all the Perl datatypes: scalars, lists, hash, arrays, and objects. This part is literally the cheat sheet for how to reach into those from your Petal templates. π«Ά
In the examples below, we're assuming your template is set up like this:
my $hashref = some_complex_data_structure();
my $template = new Petal ('foo.xml');
print $template->process ( $hashref );
Then we'll show you how the Petal Expression Syntax maps to the Perl way of grabbing those values. No cap. π
accessing scalar values π
Perl side:
$hashref->{'some_value'};
Petal side:
some_value
Example:
<!--? Replaces Hello, World with the contents of
$hashref->{'some_value'}
-->
<span tal:replace="some_value">Hello, World</span>
accessing hashes & arrays π¦
Perl side:
$hashref->{'some_hash'}->{'a_key'};
Petal side:
some_hash/a_key
Example:
<!--? Replaces Hello, World with the contents
of $hashref->{'some_hash'}->{'a_key'}
-->
<span tal:replace="some_hash/a_key">Hello, World</span>
Perl side:
$hashref->{'some_array'}->[12]
Petal side:
some_array/12
Example:
<!--? Replaces Hello, World with the contents
of $hashref->{'some_array'}->[12]
-->
<span tal:replace="some_array/12">Hello, World</span>
Note: You're more likely to want to loop through arrays, bestie:
<!--? Loops trough the array and displays each values -->
<ul tal:condition="some_array">
<li tal:repeat="value some_array"
tal:content="value">Hello, World</li>
</ul>
accessing object methods π
Perl sides:
1. $hashref->{'some_object'}->some_method();
2. $hashref->{'some_object'}->some_method ('foo', 'bar');
3. $hashref->{'some_object'}->some_method ($hashref->{'some_variable'})
Petal sides:
1. some_object/some_method
2a. some_object/some_method 'foo' 'bar'
2b. some_object/some_method "foo" "bar"
2c. some_object/some_method --foo --bar
3. some_object/some_method some_variable
Heads up: the syntax in 2c only works if your strings don't have spaces in them.
Example:
<p>
<span tal:replace="value1">2</span> times
<span tal:replace="value2">2</span> equals
<span tal:replace="math_object/multiply value1 value2">4</span>
</p>
composing π§
Petal lets you traverse any data structure, i.e.
Perl side:
$hashref->{'some_object'}
->some_method()
->{'key2'}
->some_other_method ( 'foo', $hash->{bar} );
Petal side:
some_object/some_method/key2/some_other_method --foo bar
true:EXPRESSION β
If EXPRESSION returns an array reference:
- If this array reference has at least one element β Returns
TRUE - Else β Returns
FALSE
Else:
- If
EXPRESSIONreturns a TRUE value (according to Perl 'trueness') β ReturnsTRUE - Else β Returns
FALSE
Always use the true: modifiers when you're doing Petal conditions, okay?
false:EXPRESSION π
ngl bestie, I'm pretty sure you can figure this one out on your own :-)
set:variable_name EXPRESSION π
This sets whatever EXPRESSION evaluates to into $hash->{variable_name}. Like:
Perl side:
$hash->{variable_name} = $hash->{object}->method();
Petal side:
set:variable_name object/method
string:STRING_EXPRESSION πΈ
The string: modifier is your bestie for interpolating Petal expressions inside a string and handing you back the value.
string:Welcome $user/real_name, it is $date!
Alternatively, you could write:
string:Welcome ${user/real_name}, it is ${date}!
The glow-up with curly brackets is that you can interpolate expressions that call methods with parameters, like:
string:The current CGI 'action' param is: ${cgi/param --action}
ADVANCED PETAL π
writing your own modifiers π
Petal lets you write your own modifiers, either using coderefs or modules.
Coderefs
Say you wanna write an uppercase: modifier that uppercases whatever an expression evaluates to, like:
uppercase:string:Hello, World
That would return:
HELLO, WORLD
Here's the move:
# don't forget the trailing colon in C<uppercase:> !!
$Petal::Hash::MODIFIERS->{'uppercase:'} = sub {
my $hash = shift;
my $args = shift;
my $result = $hash->fetch ($args);
return uc ($result);
};
Modules.
Maybe you'd rather use a module than a coderef. Here's the same example rewritten as a module:
package Petal::Hash::UpperCase;
use strict;
use warnings;
sub process {
my $class = shift;
my $hash = shift;
my $args = shift;
my $result = $hash->fetch ($args);
return uc ($result);
}
1;
As long as your module lives in the namespace Petal::Hash::<YourModifierName>, Petal will automatically pick it up and assign it to its lowercased name, i.e. in our example uppercase:.
If your modifier is OUTSIDE Petal::Hash::<YourModifierName>, you gotta make Petal aware of it like this:
use MyPetalModifier::UpperCase;
$Petal::Hash::MODIFIERS->{'uppercase:'} = 'MyPetalModifier::UpperCase';
Expression keywords π
XML encoding / structure keyword
By default, Petal encodes &, <, "> and " to &, <, > and " respectively. But sometimes you want to show an expression that's already encoded, and for that you use the structure keyword.
structure my/encoded/variable
Lowkey important: this is a language keyword, not a modifier. So no trailing colon, bestie.
Petal::Hash caching and fresh keyword
Petal caches the expressions it resolves. So if you write something like:
string:$foo/bar, ${baz/buz/blah}
Petal::Hash will compute it once, and then every time you access that expression again it returns the same value. This is almost never a problem, even for loops, because a new Petal::Hash object is used for each iteration to support proper scoping.
But in some rare cases you don't want that behavior, so you prefix your expression with the fresh keyword, like:
fresh string:$foo/bar, ${baz/buz/blah}
You can use fresh with structure if you need to:
fresh structure string:$foo/bar, ${baz/buz/blah}
But the reverse does NOT work:
<!--? VERY BAD, WON'T WORK !!! -->
structure fresh string:$foo/bar, ${baz/buz/blah}
TOY FUNCTIONS (For debugging or if you're curious) π§Έ
perl -MPetal -e canonical template.xml
This shows you the canonical template for template.xml. You can set $Petal::INPUT by setting the PETAL_INPUT environment variable. You can set $Petal::OUTPUT by setting the PETAL_OUTPUT environment variable.
perl -MPetal -e code template.xml
This shows you the perl code for template.xml. You can set $Petal::INPUT by setting the PETAL_INPUT environment variable. You can set $Petal::OUTPUT by setting the PETAL_OUTPUT environment variable.
perl -MPetal -e lcode template.xml
This shows you the perl code for template.xml, with line numbers. You can set $Petal::INPUT by setting the PETAL_INPUT environment variable. You can set $Petal::OUTPUT by setting the PETAL_OUTPUT environment variable.
What does Petal do internally? π§
The cycle of a Petal template is the following:
1. Read the source XML template
2. $INPUT (XML or HTML) throws XML events from the source file
3. $OUTPUT (XML or HTML) uses these XML events to canonicalize the template
4. Petal::CodeGenerator turns the canonical template into Perl code
5. Petal::Cache::Disk caches the Perl code on disk
6. Petal turns the perl code into a subroutine
7. Petal::Cache::Memory caches the subroutine in memory
8. Petal executes the subroutine
9. (optional) Petal internationalizes the resulting output.
If you're in a persistent environment like mod_perl, later calls to the same template get reduced to step 8 until the source template changes.
Otherwise, later calls resume at step 6, until the source template changes.
If you're using the mod_perl prefork MPM, you can precompile Petal templates into Apache's shared memory at startup with the cache_only option. That lets you run through steps 1-7 without passing any data to Petal.
DECRYPTING WARNINGS AND ERRORS π¨
"Cannot import module $module. Reason: $@" (nonfatal)
Petal couldn't import one of the modules. This warning shows up when Petal can't load a plugin because it's been "badly install" or is just broken.
"Petal modifier encode: is deprecated" (nonfatal)
You don't need to use encode:EXPRESSION to XML-encode expressions anymoreβPetal does it for you. encode: has been turned into a no-op.
Cannot find value for ... (FATAL)
You tried to invoke an/expression/like/this/one but Petal couldn't resolve it. This can happen when an/expression/like evaluated to undef, so the remaining this/one couldn't be resolved.
Usually Petal gives you a line number and a dump of your template as Perl code. You can look at the perl code to figure out the faulty bit in your template.
not well-formed (invalid token) at ... (FATAL)
Petal was trying to parse a file that isn't well-formed XML or has weird entities in it. Try running xmllint on your file to check if it's well formed, or try using the $Petal::INPUT = 'XHTML' option.
other errors
Either I forgot to document it, or it's a bug. Send an email to the Petal mailing list.
EXPORTS π¦
None. That's it, bestie. β¨
AUTHOR π
Copyright 2003 - MKDoc Ltd.
Authors: Jean-Michel Hiver, Fergal Daly <fergal@esatclear.ie>, and others.
This module free software and is distributed under the same license as Perl itself. Use it at your own risk.
Big thanks to everyone on the list who contributed to Petal in the form of patches, bug reports, and suggestions. See README for a list of contributors.
SEE ALSO π
Join the Petal mailing list:
http://lists.webarch.co.uk/mailman/listinfo/petal
Mailing list archives:
http://lists.webarch.co.uk/pipermail/petal
Have a peek at the TAL / TALES / METAL specs:
http://wiki.zope.org/ZPT/TAL
http://wiki.zope.org/ZPT/TALES
http://wiki.zope.org/ZPT/METAL
That's a wrap, bestie! This page came fromperl v5.36.0, dated2022-11-19, and it's thePetal(3pm)manual. πβ¨
π¦ where this page comes from
- debian bookworm: libpetal-perl 2.26-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libpetal-perl 2.26-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpetal-perl 2.26-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpetal-perl 2.26-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpetal-perl 2.26-2 Β· 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