./PaxHeaders.604/Petal-2.250000644000000000000000000000013213431073567012166 xustar0030 mtime=1550088055.245412827 30 atime=1550088055.137412486 30 ctime=1550088055.245412827 Petal-2.25/0000755000175000001440000000000013431073567012670 5ustar00nineusers00000000000000Petal-2.25/PaxHeaders.604/t0000644000000000000000000000013213431073567012274 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.137412486 30 ctime=1550088055.157412549 Petal-2.25/t/0000755000175000001440000000000013431073567013133 5ustar00nineusers00000000000000Petal-2.25/t/PaxHeaders.604/data0000644000000000000000000000013213431073567013205 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.137412486 30 ctime=1550088055.157412549 Petal-2.25/t/data/0000755000175000001440000000000013431073567014044 5ustar00nineusers00000000000000Petal-2.25/t/data/PaxHeaders.604/attributes_andquot.xml0000644000000000000000000000007411714720667017734 xustar0030 atime=1398329059.992463569 30 ctime=1550088055.137412486 Petal-2.25/t/data/attributes_andquot.xml0000644000175000001440000000007411714720667020512 0ustar00nineusers00000000000000 yoyoyo Petal-2.25/t/data/PaxHeaders.604/eval2.xml0000644000000000000000000000007411714720667015024 xustar0030 atime=1398329060.024463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/eval2.xml0000644000175000001440000000017511714720667015604 0ustar00nineusers00000000000000$this/aint/gonna/work $this/aint/gonna/work Petal-2.25/t/data/PaxHeaders.604/namespaces.xml0000644000000000000000000000007411714720667016132 xustar0030 atime=1398329060.060463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/namespaces.xml0000644000175000001440000000045011714720667016706 0ustar00nineusers00000000000000

yo

yo

yo

Petal-2.25/t/data/PaxHeaders.604/dollar-one.xml0000644000000000000000000000007411714720667016047 xustar0030 atime=1398329060.008463569 30 ctime=1550088055.137412486 Petal-2.25/t/data/dollar-one.xml0000644000175000001440000000013311714720667016621 0ustar00nineusers00000000000000 $ $$ $_ $foo ${foo} $@ $1 Petal-2.25/t/data/PaxHeaders.604/set_cache_fresh.xml0000644000000000000000000000007411714720667017120 xustar0030 atime=1398329060.072463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/set_cache_fresh.xml0000644000175000001440000000022011714720667017667 0ustar00nineusers00000000000000 a = *** a = Petal-2.25/t/data/PaxHeaders.604/test_ns_attributes0000644000000000000000000000013213431073567017132 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.137412486 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_ns_attributes/0000755000175000001440000000000013431073567017771 5ustar00nineusers00000000000000Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes4.xml0000644000000000000000000000007411714720667023751 xustar0030 atime=1398329060.160463567 30 ctime=1550088055.137412486 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes4.xml0000644000175000001440000000036011714720667024525 0ustar00nineusers00000000000000 Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes7.xml0000644000000000000000000000007411714720667023754 xustar0030 atime=1398329060.164463567 30 ctime=1550088055.137412486 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes7.xml0000644000175000001440000000055611714720667024537 0ustar00nineusers00000000000000 Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes6.xml0000644000000000000000000000007411714720667023753 xustar0030 atime=1398329060.164463567 30 ctime=1550088055.141412499 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes6.xml0000644000175000001440000000055611714720667024536 0ustar00nineusers00000000000000 Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes5.xml0000644000000000000000000000007411714720667023752 xustar0030 atime=1398329060.164463567 30 ctime=1550088055.145412511 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes5.xml0000644000175000001440000000036011714720667024526 0ustar00nineusers00000000000000 Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes2.xml0000644000000000000000000000007411714720667023747 xustar0030 atime=1398329060.160463567 30 ctime=1550088055.149412525 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes2.xml0000644000175000001440000000025611714720667024527 0ustar00nineusers00000000000000 Default Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_rightWayOfDoing.xml0000644000000000000000000000007411714720667024043 xustar0030 atime=1398329060.168463567 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_ns_attributes/test_rightWayOfDoing.xml0000644000175000001440000000051311714720667024617 0ustar00nineusers00000000000000 Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes3.xml0000644000000000000000000000007411714720667023750 xustar0030 atime=1398329060.160463567 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes3.xml0000644000175000001440000000025611714720667024530 0ustar00nineusers00000000000000 Default Petal-2.25/t/data/test_ns_attributes/PaxHeaders.604/test_ns_attributes1.xml0000644000000000000000000000007411714720667023746 xustar0030 atime=1398329060.156463567 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_ns_attributes/test_ns_attributes1.xml0000644000175000001440000000023711714720667024525 0ustar00nineusers00000000000000 Default Petal-2.25/t/data/PaxHeaders.604/prefix.xml0000644000000000000000000000007411714720667015310 xustar0030 atime=1398329060.068463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/prefix.xml0000644000175000001440000000005011714720667016060 0ustar00nineusers00000000000000This is a test Petal-2.25/t/data/PaxHeaders.604/nbsp.html0000644000000000000000000000007411714720667015121 xustar0030 atime=1398329060.060463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/nbsp.html0000644000175000001440000000013211714720667015672 0ustar00nineusers00000000000000 (   ) Petal-2.25/t/data/PaxHeaders.604/include0000644000000000000000000000013213431073567014630 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.137412486 30 ctime=1550088055.149412525 Petal-2.25/t/data/include/0000755000175000001440000000000013431073567015467 5ustar00nineusers00000000000000Petal-2.25/t/data/include/PaxHeaders.604/index_xinclude2.xml0000644000000000000000000000007411714720667020522 xustar0030 atime=1398329060.104463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/include/index_xinclude2.xml0000644000175000001440000000014011714720667021272 0ustar00nineusers00000000000000 Petal-2.25/t/data/include/PaxHeaders.604/index.xml0000644000000000000000000000007411714720667016545 xustar0030 atime=1398329060.100463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/include/index.xml0000644000175000001440000004552211714720667017332 0ustar00nineusers00000000000000 MKDoc
MKDoc

| Content | Home | Sitemap |


MKDoc

MKDoc is a web site content management system that has been designed to make the creation of usable, accessible, semantically rich and valid web sites as easy as possible.

MKDoc provides different ways for the public to interact with and navigate between documents including a sitemap, search facility, Dublin Core RDF metadata for documents and printer versions of pages.

All management of an MKDoc web site, document creation, editing and organising is done via a standard web browser. This site has been created using MKDoc. The look of an MKDoc web site is controlled using templates.

Additional features of MKDoc are documented in the features section of this site.

Extensive help for users of MKDoc is available, explaining how to login, create and edit documents on an MKDoc website.

Try it

If you would like to play with MKDoc, you can sign up for an account on the testers site. If you would like to evaluate MKDoc on your own server please visit the MKDoc download site.

Buy it

Buy a hosted solution

Fully managed solutions, including domain name registration, email forwarding and template design, are available from WebArch.net.

Buy a MKDoc Server License

Once MKDoc is installed on to a server then it is possible to use the software to serve multiple discrete web sites. (Please check the basic server requirements on the MKDoc download site).

We offer 3 different licenses each of which includes email support and software upgrades for one year:

  • Single Web Site License - 800 Euros
  • 10 Web Site License - 4000 Euros - installation included
  • CPU License (unlimited number of web sites) - 8000 Euros - installation included

If you wish to purchase a license please email solutions@mkdoc.com with your requirements.

Latest Documents

The latest news about MKDoc developments:

MKDoc version 1.4
MKDoc 1.4. has been released. It features Unicode support, HTTP authentication and a brand new photo component.
Booth Centre website launched
The Booth Centre, a charity for homeless people in Manchester, UK, launched their new website today, it runs MKDoc.
Laptop Challenge - the first multi-lingual MKDoc site
Tomorrow the Laptops in the Community Challenge event will start and MKDoc will be used to author web content in multiple languages during the event.
MKDoc in Japanese
The latest version of MKDoc now has full Unicode / UTF-8 support and a Japanese translation is underway.
MKDoc in Punjabi
Some early development screen shots of a UTF-8 development version MKDoc with Punjabi templates.
MKDoc version 1.2
MKDoc 1.2 has just been added to the downloads site. It has new features, better speed and bug-fixes. Be sure to check it out!

| Printer Version | DCMI RDF Metadata | RSS 0.9 Headlines | RSS 0.91 Headlines | RSS 1.0 Headlines | RSS 1.0 Sitemap |

This page conforms to the W3C's WAI Accessibility Guidelines, level Double-A, which can be checked with Bobby, is valid XHTML 1.0 and uses valid CSS.

Last updated by Adam Moran on 2002-05-28 17:12:44
MKDoc Ltd. c/o webarchitects, PO Box 1660, Sheffield, S7 1XF, UK.
Copyright © 2001-2002 MKDoc Ltd.
Petal-2.25/t/data/include/PaxHeaders.604/included.xml0000644000000000000000000000007411714720667017225 xustar0030 atime=1398329060.100463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/include/included.xml0000644000175000001440000000012111714720667017774 0ustar00nineusers00000000000000

__INCLUDED__

__INCLUDED__

$test_encoding

Petal-2.25/t/data/include/PaxHeaders.604/deep0000644000000000000000000000013213431073567015545 xustar0030 mtime=1550088055.145412511 30 atime=1550088055.145412511 30 ctime=1550088055.145412511 Petal-2.25/t/data/include/deep/0000755000175000001440000000000013431073567016404 5ustar00nineusers00000000000000Petal-2.25/t/data/include/deep/PaxHeaders.604/index.xml0000644000000000000000000000007411714720667017462 xustar0030 atime=1398329060.104463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/include/deep/index.xml0000644000175000001440000000014111714720667020233 0ustar00nineusers00000000000000 Petal-2.25/t/data/include/PaxHeaders.604/index_xinclude.xml0000644000000000000000000000007411714720667020440 xustar0030 atime=1398329060.104463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/include/index_xinclude.xml0000644000175000001440000000013611714720667021215 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/metal_use_macro.xml0000644000000000000000000000007411714720667017152 xustar0030 atime=1398329060.056463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/metal_use_macro.xml0000644000175000001440000000033511714720667017730 0ustar00nineusers00000000000000 This is some stuff which should appear. It's gonna use some 'test foo' stuff. This is some super mockup data. It should not appear. Petal-2.25/t/data/PaxHeaders.604/inline_vars.xml0000644000000000000000000000007411714720667016324 xustar0030 atime=1398329060.040463568 30 ctime=1550088055.137412486 Petal-2.25/t/data/inline_vars.xml0000644000175000001440000000004311714720667017076 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/children.xml0000644000000000000000000000007411714720667015603 xustar0030 atime=1398329059.996463569 30 ctime=1550088055.137412486 Petal-2.25/t/data/children.xml0000644000175000001440000000113211714720667016355 0ustar00nineusers00000000000000

Document Title

Petal-2.25/t/data/PaxHeaders.604/xhtml_omit_tag.html0000644000000000000000000000007411714720667017176 xustar0030 atime=1398329060.088463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/xhtml_omit_tag.html0000644000175000001440000000101511714720667017750 0ustar00nineusers00000000000000 Petal XHTML Output Bug Report

Replace This!

Petal-2.25/t/data/PaxHeaders.604/language0000644000000000000000000000013213431073567014770 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.141412499 30 ctime=1550088055.153412537 Petal-2.25/t/data/language/0000755000175000001440000000000013431073567015627 5ustar00nineusers00000000000000Petal-2.25/t/data/language/PaxHeaders.604/exists_filename0000644000000000000000000000013213431073567020147 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.141412499 30 ctime=1550088055.157412549 Petal-2.25/t/data/language/exists_filename/0000755000175000001440000000000013431073567021006 5ustar00nineusers00000000000000Petal-2.25/t/data/language/exists_filename/PaxHeaders.604/fr-CA.html0000644000000000000000000000007411714720667022011 xustar0030 atime=1398329060.108463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/language/exists_filename/fr-CA.html0000644000175000001440000000000011714720667022554 0ustar00nineusers00000000000000Petal-2.25/t/data/language/exists_filename/PaxHeaders.604/fr.xml0000644000000000000000000000007411714720667021364 xustar0030 atime=1398329060.108463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/language/exists_filename/fr.xml0000644000175000001440000000000011714720667022127 0ustar00nineusers00000000000000Petal-2.25/t/data/language/PaxHeaders.604/fr.xml0000644000000000000000000000007411714720667016205 xustar0030 atime=1398329060.108463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/language/fr.xml0000644000175000001440000000005411714720667016761 0ustar00nineusers00000000000000

Petal-2.25/t/data/language/PaxHeaders.604/include0000644000000000000000000000013213431073567016413 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.153412537 30 ctime=1550088055.157412549 Petal-2.25/t/data/language/include/0000755000175000001440000000000013431073567017252 5ustar00nineusers00000000000000Petal-2.25/t/data/language/include/PaxHeaders.604/fr-CA.html0000644000000000000000000000007411714720667020255 xustar0030 atime=1398329060.112463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/language/include/fr-CA.html0000644000175000001440000000004411714720667021030 0ustar00nineusers00000000000000Bonjour, Monde (fr-CA) Petal-2.25/t/data/language/include/PaxHeaders.604/fr.html0000644000000000000000000000007411714720667017774 xustar0030 atime=1398329060.112463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/language/include/fr.html0000644000175000001440000000004111714720667020544 0ustar00nineusers00000000000000Bonjour, Monde (fr) Petal-2.25/t/data/PaxHeaders.604/gettext0000644000000000000000000000013213431073567014671 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.141412499 30 ctime=1550088055.149412525 Petal-2.25/t/data/gettext/0000755000175000001440000000000013431073567015530 5ustar00nineusers00000000000000Petal-2.25/t/data/gettext/PaxHeaders.604/html0000644000000000000000000000013213431073567015635 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.141412499 30 ctime=1550088055.149412525 Petal-2.25/t/data/gettext/html/0000755000175000001440000000000013431073567016474 5ustar00nineusers00000000000000Petal-2.25/t/data/gettext/html/PaxHeaders.604/index.html0000644000000000000000000000007411714720667017716 xustar0030 atime=1398329060.088463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/gettext/html/index.html0000644000175000001440000000065311714720667020477 0ustar00nineusers00000000000000

Hello, this is a test.

You are user Fred

Google Petal-2.25/t/data/gettext/html/PaxHeaders.604/menu-no-css.html0000644000000000000000000000007411714720667020753 xustar0030 atime=1398329060.088463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/gettext/html/menu-no-css.html0000644000175000001440000000332111714720667021527 0ustar00nineusers00000000000000

Skip Navigation

Petal-2.25/t/data/gettext/PaxHeaders.604/mo0000644000000000000000000000013213431073567015304 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.141412499 30 ctime=1550088055.149412525 Petal-2.25/t/data/gettext/mo/0000755000175000001440000000000013431073567016143 5ustar00nineusers00000000000000Petal-2.25/t/data/gettext/mo/PaxHeaders.604/fr.mo0000644000000000000000000000007411714720667016334 xustar0030 atime=1398329060.092463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/gettext/mo/fr.mo0000644000175000001440000000157111714720667017115 0ustar00nineusers00000000000000Þ•L |¨I©óö  ™&aÀ"%@%SSkip the navigation and jump straight to the page content [ Accesskey S ]enhello-this-is-a-testmenu-skip-navyou-are-userProject-Id-Version: PACKAGE VERSION POT-Creation-Date: 2004-07-21 15:02+0000 PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE Last-Translator: FULL NAME Language-Team: LANGUAGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0 Language-Code: en Language-Name: English Preferred-Encodings: utf-8 Domain: testdomain Passez le menu de navigation et allez directement au contenu de la page [ Clef d'accès S ]frBonjour, ceci est un test.Ignorer NavigationVous êtes l'utilisateur ${user}Petal-2.25/t/data/gettext/mo/PaxHeaders.604/en.mo0000644000000000000000000000007411714720667016327 xustar0030 atime=1398329060.092463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/gettext/mo/en.mo0000644000175000001440000000151111714720667017102 0ustar00nineusers00000000000000Þ•L |¨I©óö  ™&IÀ  $4Skip the navigation and jump straight to the page content [ Accesskey S ]enhello-this-is-a-testmenu-skip-navyou-are-userProject-Id-Version: PACKAGE VERSION POT-Creation-Date: 2004-07-21 15:02+0000 PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE Last-Translator: FULL NAME Language-Team: LANGUAGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0 Language-Code: en Language-Name: English Preferred-Encodings: utf-8 Domain: testdomain Skip the navigation and jump straight to the page content [ Accesskey S ]enHello, this is a test.Skip NavigationYou are user ${user}Petal-2.25/t/data/gettext/PaxHeaders.604/po0000644000000000000000000000013213431073567015307 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.149412525 30 ctime=1550088055.157412549 Petal-2.25/t/data/gettext/po/0000755000175000001440000000000013431073567016146 5ustar00nineusers00000000000000Petal-2.25/t/data/gettext/po/PaxHeaders.604/fr.po0000644000000000000000000000007411714720667016342 xustar0030 atime=1398329060.096463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/gettext/po/fr.po0000644000175000001440000000505111714720667017120 0ustar00nineusers00000000000000# --- PLEASE EDIT THE LINES BELOW CORRECTLY --- # SOME DESCRIPTIVE TITLE. # FIRST AUTHOR , YEAR. msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2004-07-21 15:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0\n" "Language-Code: en\n" "Language-Name: English\n" "Preferred-Encodings: utf-8\n" "Domain: testdomain\n" #. #: t/data/gettext/html/menu-no-css.html msgid "" "Skip the navigation and jump straight to the page content [ Accesskey S ]" msgstr "Passez le menu de navigation et allez directement au contenu de la page [ Clef d'accès S ]" #. #: t/data/gettext/html/index.html #, fuzzy msgid "a search engine" msgstr "un moteur de recherche" # # 1 more: t/data/gettext/html/menu-no-css.html #. #: t/data/gettext/html/menu-no-css.html msgid "en" msgstr "fr" #.

#. Hello, this is a test. #.

#: t/data/gettext/html/index.html msgid "hello-this-is-a-test" msgstr "Bonjour, ceci est un test." #.
#. Skip Navigation #. #: t/data/gettext/html/menu-no-css.html msgid "menu-skip-nav" msgstr "Ignorer Navigation" #.

#. You are user #. ${user} #.

#: t/data/gettext/html/index.html msgid "you-are-user" msgstr "Vous êtes l'utilisateur ${user}" Petal-2.25/t/data/gettext/po/PaxHeaders.604/en.po0000644000000000000000000000007411714720667016335 xustar0030 atime=1398329060.092463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/gettext/po/en.po0000644000175000001440000000476311714720667017124 0ustar00nineusers00000000000000# --- PLEASE EDIT THE LINES BELOW CORRECTLY --- # SOME DESCRIPTIVE TITLE. # FIRST AUTHOR , YEAR. msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2004-07-21 15:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0\n" "Language-Code: en\n" "Language-Name: English\n" "Preferred-Encodings: utf-8\n" "Domain: testdomain\n" #. #: t/data/gettext/html/menu-no-css.html msgid "" "Skip the navigation and jump straight to the page content [ Accesskey S ]" msgstr "Skip the navigation and jump straight to the page content [ Accesskey S ]" #. #: t/data/gettext/html/index.html #, fuzzy msgid "a search engine" msgstr "A search engine." # # 1 more: t/data/gettext/html/menu-no-css.html #. #: t/data/gettext/html/menu-no-css.html msgid "en" msgstr "en" #.

#. Hello, this is a test. #.

#: t/data/gettext/html/index.html msgid "hello-this-is-a-test" msgstr "Hello, this is a test." #.
#. Skip Navigation #. #: t/data/gettext/html/menu-no-css.html msgid "menu-skip-nav" msgstr "Skip Navigation" #.

#. You are user #. ${user} #.

#: t/data/gettext/html/index.html msgid "you-are-user" msgstr "You are user ${user}" Petal-2.25/t/data/gettext/po/PaxHeaders.604/index.pot0000644000000000000000000000007411714720667017226 xustar0030 atime=1398329060.096463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/gettext/po/index.pot0000644000175000001440000000520211714720667020002 0ustar00nineusers00000000000000# --- PLEASE EDIT THE LINES BELOW CORRECTLY --- # SOME DESCRIPTIVE TITLE. # FIRST AUTHOR , YEAR. msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2004-07-21 15:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0\n" "Language-Code: en\n" "Language-Name: English\n" "Preferred-Encodings: latin1 utf-8\n" "Domain: testdomain\n" #: t/data/gettext/html/menu-no-css.html #. msgid "Skip the navigation and jump straight to the page content [ Accesskey S ]" msgstr "" #: t/data/gettext/html/index.html #. msgid "a search engine" msgstr "" #: t/data/gettext/html/menu-no-css.html #. ## 1 more: t/data/gettext/html/menu-no-css.html msgid "en" msgstr "" #: t/data/gettext/html/index.html #.

#. Hello, this is a test. #.

msgid "hello-this-is-a-test" msgstr "Hello, this is a test." #: t/data/gettext/html/menu-no-css.html #.
#. Skip Navigation #. msgid "menu-skip-nav" msgstr "Skip Navigation" #: t/data/gettext/html/index.html #.

#. You are user #. ${user} #.

msgid "you-are-user" msgstr "You are user ${user}" #- Removed msgids: # #- Added msgids: # hello-this-is-a-test you-are-user "a search engine" menu-skip-nav en # "Skip the navigation and jump straight to the page content [ Accesskey S ]" #- Added msgids by merging file None: # Petal-2.25/t/data/PaxHeaders.604/eval.xml0000644000000000000000000000007411714720667014742 xustar0030 atime=1398329060.024463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/eval.xml0000644000175000001440000000106111714720667015515 0ustar00nineusers00000000000000
  • Hello
  • This is an eval test: But this is going to work, however it still should not appear in the final result because it's within an eval that fails $this/aint/gonna/work
    Petal-2.25/t/data/PaxHeaders.604/metal_self_include.xml0000644000000000000000000000007411714720667017631 xustar0030 atime=1398329060.056463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/metal_self_include.xml0000644000175000001440000000014711714720667020410 0ustar00nineusers00000000000000 Foo Glop Petal-2.25/t/data/PaxHeaders.604/if.html0000644000000000000000000000007411714720667014555 xustar0030 atime=1398329060.036463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/if.html0000644000175000001440000000012211714720667015325 0ustar00nineusers00000000000000

    Error Message

    Petal-2.25/t/data/PaxHeaders.604/multiple_includes0000644000000000000000000000013213431073567016726 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.141412499 30 ctime=1550088055.157412549 Petal-2.25/t/data/multiple_includes/0000755000175000001440000000000013431073567017565 5ustar00nineusers00000000000000Petal-2.25/t/data/multiple_includes/PaxHeaders.604/includes0000644000000000000000000000013213431073567020534 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.141412499 30 ctime=1550088055.157412549 Petal-2.25/t/data/multiple_includes/includes/0000755000175000001440000000000013431073567021373 5ustar00nineusers00000000000000Petal-2.25/t/data/multiple_includes/includes/PaxHeaders.604/header.tmpl0000644000000000000000000000007411714720667022746 xustar0030 atime=1398329060.136463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/multiple_includes/includes/header.tmpl0000644000175000001440000000021211714720667023516 0ustar00nineusers00000000000000
    Copyright 2002, Queens University of Charlotte
    Petal-2.25/t/data/multiple_includes/includes/PaxHeaders.604/footer.tmpl0000644000000000000000000000007411714720667023014 xustar0030 atime=1398329060.136463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/multiple_includes/includes/footer.tmpl0000644000175000001440000000021211714720667023564 0ustar00nineusers00000000000000
    Copyright 2002, Queens University of Charlotte
    Petal-2.25/t/data/multiple_includes/PaxHeaders.604/test.tmpl0000644000000000000000000000007411714720667020667 xustar0030 atime=1398329060.132463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/multiple_includes/test.tmpl0000644000175000001440000000455311714720667021453 0ustar00nineusers00000000000000 Petal Stress Test Template

    The tags:

    • First
    • Last
    • Last

    The Tests

    0. Inline variable with underscore: $last_name

    $align - $align_opposite - Hello World

    1. A tag within an html tag property doesn't work, in some cases. Works if there is no include tag above it. Does not work if there is an include tag above it.
    ">Email

    2. Two tags in a row will only show the first, or nothing at all. I'm not sure why this format isn't working at all in this test template. It does work in another of my templates. Perhaps it is due to the error in the above tag. Commenting out the above tag doesn't seem to make any difference, though. Do tags inside of comments get executed?

    3. Includes don't always work. Try moving one of the tags to the top and see the results. Rather curious... If you move the footer to the top, you'll see that it gets shown twice if you have 2 footer includes statements following it; if you remove the last one just above the /body tag, you'll see the one after header isn't working, but further ones do. There is apparently something in the header.tmpl document which is causing Petal to not perform the next includes. In fact, you can keep adding footer includes and get more and more results as expected.

    This include won't get displayed

    End Tests

    Petal-2.25/t/data/multiple_includes/PaxHeaders.604/register_form.tmpl0000644000000000000000000000007411714720667022557 xustar0030 atime=1398329060.132463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/multiple_includes/register_form.tmpl0000644000175000001440000000065111714720667023336 0ustar00nineusers00000000000000 Register to Become a Coach Petal-2.25/t/data/PaxHeaders.604/locale0000644000000000000000000000013213431073567014444 xustar0030 mtime=1550088055.145412511 30 atime=1550088055.141412499 30 ctime=1550088055.145412511 Petal-2.25/t/data/locale/0000755000175000001440000000000013431073567015303 5ustar00nineusers00000000000000Petal-2.25/t/data/locale/PaxHeaders.604/testdomain.pot0000644000000000000000000000007411714720667017423 xustar0030 atime=1398329060.116463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/locale/testdomain.pot0000644000175000001440000000005411714720667020177 0ustar00nineusers00000000000000msgid "hello, world" msgstr "Hello, World" Petal-2.25/t/data/locale/PaxHeaders.604/fr0000644000000000000000000000013213431073567015053 xustar0030 mtime=1550088055.141412499 30 atime=1550088055.141412499 30 ctime=1550088055.141412499 Petal-2.25/t/data/locale/fr/0000755000175000001440000000000013431073567015712 5ustar00nineusers00000000000000Petal-2.25/t/data/locale/fr/PaxHeaders.604/LC_MESSAGES0000644000000000000000000000013213431073567016640 xustar0030 mtime=1550088055.145412511 30 atime=1550088055.141412499 30 ctime=1550088055.145412511 Petal-2.25/t/data/locale/fr/LC_MESSAGES/0000755000175000001440000000000013431073567017477 5ustar00nineusers00000000000000Petal-2.25/t/data/locale/fr/LC_MESSAGES/PaxHeaders.604/testdomain.mo0000644000000000000000000000007411714720667021430 xustar0030 atime=1398329060.124463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/locale/fr/LC_MESSAGES/testdomain.mo0000644000175000001440000000052611714720667022210 0ustar00nineusers00000000000000Þ•,<P Qå^Dhello, worldProject-Id-Version: PACKAGE VERSION Last-Translator: Automatically generated Language-Team: none MIME-Version: 1.0 Content-Type: text/plain; charset=ASCII Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n > 1); Bonjour, le mondePetal-2.25/t/data/locale/fr/LC_MESSAGES/PaxHeaders.604/testdomain.po0000644000000000000000000000007411714720667021433 xustar0030 atime=1398329060.124463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/locale/fr/LC_MESSAGES/testdomain.po0000644000175000001440000000050511714720667022210 0ustar00nineusers00000000000000msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" msgid "hello, world" msgstr "Bonjour, le monde" Petal-2.25/t/data/locale/PaxHeaders.604/es0000644000000000000000000000013213431073567015053 xustar0030 mtime=1550088055.145412511 30 atime=1550088055.145412511 30 ctime=1550088055.145412511 Petal-2.25/t/data/locale/es/0000755000175000001440000000000013431073567015712 5ustar00nineusers00000000000000Petal-2.25/t/data/locale/es/PaxHeaders.604/LC_MESSAGES0000644000000000000000000000013213431073567016640 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.145412511 30 ctime=1550088055.149412525 Petal-2.25/t/data/locale/es/LC_MESSAGES/0000755000175000001440000000000013431073567017477 5ustar00nineusers00000000000000Petal-2.25/t/data/locale/es/LC_MESSAGES/PaxHeaders.604/testdomain.mo0000644000000000000000000000007411714720667021430 xustar0030 atime=1398329060.116463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/locale/es/LC_MESSAGES/testdomain.mo0000644000175000001440000000052111714720667022203 0ustar00nineusers00000000000000Þ•,<P Qæ^ Ehello, worldProject-Id-Version: PACKAGE VERSION Last-Translator: Automatically generated Language-Team: none MIME-Version: 1.0 Content-Type: text/plain; charset=ASCII Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Hola, MundoPetal-2.25/t/data/locale/es/LC_MESSAGES/PaxHeaders.604/testdomain.po0000644000000000000000000000007411714720667021433 xustar0030 atime=1398329060.116463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/locale/es/LC_MESSAGES/testdomain.po0000644000175000001440000000050011714720667022203 0ustar00nineusers00000000000000msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "hello, world" msgstr "Hola, Mundo" Petal-2.25/t/data/PaxHeaders.604/omit-tag.xml0000644000000000000000000000007411714720667015534 xustar0030 atime=1398329060.064463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/omit-tag.xml0000644000175000001440000000031211714720667016305 0ustar00nineusers00000000000000

    This tag should not be omited (false expr) This tag should be omited (true expr) Is this a bug?

    Petal-2.25/t/data/PaxHeaders.604/i18n-test.html0000644000000000000000000000007411714720667015713 xustar0030 atime=1398329060.036463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/i18n-test.html0000644000175000001440000000031111714720667016463 0ustar00nineusers00000000000000

    Hello, World

    Petal-2.25/t/data/PaxHeaders.604/if.xml0000644000000000000000000000007411714720667014411 xustar0030 atime=1398329060.036463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/if.xml0000644000175000001440000000013111714720667015161 0ustar00nineusers00000000000000

    Error Message

    Petal-2.25/t/data/PaxHeaders.604/pass_variables0000644000000000000000000000013213431073567016203 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.141412499 30 ctime=1550088055.153412537 Petal-2.25/t/data/pass_variables/0000755000175000001440000000000013431073567017042 5ustar00nineusers00000000000000Petal-2.25/t/data/pass_variables/PaxHeaders.604/content.html0000644000000000000000000000007411714720667020627 xustar0030 atime=1398329060.140463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/pass_variables/content.html0000644000175000001440000000052211714720667021403 0ustar00nineusers00000000000000 Object 0: replace me Object 1: replace me Object 2: replace me Petal-2.25/t/data/pass_variables/PaxHeaders.604/no_arguments.html0000644000000000000000000000007411714720667021656 xustar0030 atime=1398329060.144463567 30 ctime=1550088055.149412525 Petal-2.25/t/data/pass_variables/no_arguments.html0000644000175000001440000000026711714720667022440 0ustar00nineusers00000000000000 No arguments passed. Petal-2.25/t/data/pass_variables/PaxHeaders.604/attributes.html0000644000000000000000000000007411714720667021343 xustar0030 atime=1398329060.140463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/pass_variables/attributes.html0000644000175000001440000000052711714720667022124 0ustar00nineusers00000000000000 Object 0: ... Object 1: ... Object 2: ... Petal-2.25/t/data/pass_variables/PaxHeaders.604/ih.html0000644000000000000000000000007411714720667017555 xustar0030 atime=1398329060.144463567 30 ctime=1550088055.149412525 Petal-2.25/t/data/pass_variables/ih.html0000644000175000001440000000056511714720667020340 0ustar00nineusers00000000000000 Object 1: $t1 Object 2: $t2 Object 3: $t3 Object 4: $t4 Petal-2.25/t/data/pass_variables/PaxHeaders.604/replace.html0000644000000000000000000000007411714720667020570 xustar0030 atime=1398329060.148463567 30 ctime=1550088055.149412525 Petal-2.25/t/data/pass_variables/replace.html0000644000175000001440000000066411714720667021353 0ustar00nineusers00000000000000 Object 0: replace me Object 1: replace me Object 2: replace me Object 3: Object 4: Petal-2.25/t/data/pass_variables/PaxHeaders.604/set.html0000644000000000000000000000007411714720667017750 xustar0030 atime=1398329060.148463567 30 ctime=1550088055.149412525 Petal-2.25/t/data/pass_variables/set.html0000644000175000001440000000047111714720667020527 0ustar00nineusers00000000000000 Object 0: $t0 Object 1: $t1 Object 2: $t2 Petal-2.25/t/data/pass_variables/PaxHeaders.604/if.html0000644000000000000000000000007411714720667017553 xustar0030 atime=1398329060.144463567 30 ctime=1550088055.153412537 Petal-2.25/t/data/pass_variables/if.html0000644000175000001440000000063511714720667020334 0ustar00nineusers00000000000000 Object 0: Object 1: Object 2: Petal-2.25/t/data/pass_variables/PaxHeaders.604/repeat.html0000644000000000000000000000007411714720667020435 xustar0030 atime=1398329060.148463567 30 ctime=1550088055.153412537 Petal-2.25/t/data/pass_variables/repeat.html0000644000175000001440000000040411714720667021210 0ustar00nineusers00000000000000 Object 1: $type Object 2: $type Petal-2.25/t/data/PaxHeaders.604/metal-define-slot.html0000644000000000000000000000007411714720667017470 xustar0030 atime=1398329060.052463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/metal-define-slot.html0000644000175000001440000000045111714720667020245 0ustar00nineusers00000000000000
    Test Replace
    This should be included in the result, however the following can be defined by the including page:

    Test

    Petal-2.25/t/data/PaxHeaders.604/attribute-newline.xml0000644000000000000000000000007411714720667017455 xustar0030 atime=1398329059.988463569 30 ctime=1550088055.141412499 Petal-2.25/t/data/attribute-newline.xml0000644000175000001440000000156011714720667020234 0ustar00nineusers00000000000000
    $foo
    $bar
    xxx
    xxx
    Petal-2.25/t/data/PaxHeaders.604/infinite_includes.xml0000644000000000000000000000007411714720667017506 xustar0030 atime=1398329060.040463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/infinite_includes.xml0000644000175000001440000000022211714720667020257 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/metal_define_macro.xml0000644000000000000000000000007411714720667017610 xustar0030 atime=1398329060.052463568 30 ctime=1550088055.141412499 Petal-2.25/t/data/metal_define_macro.xml0000644000175000001440000000050311714720667020363 0ustar00nineusers00000000000000 Foo Bar Baz Petal-2.25/t/data/PaxHeaders.604/multiple-attributes.xml0000644000000000000000000000007411714720667020032 xustar0030 atime=1398329060.060463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/multiple-attributes.xml0000644000175000001440000000033211714720667020605 0ustar00nineusers00000000000000 Some stuff Some other stuff Petal-2.25/t/data/PaxHeaders.604/html_errors0000644000000000000000000000013213431073567015545 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.145412511 30 ctime=1550088055.149412525 Petal-2.25/t/data/html_errors/0000755000175000001440000000000013431073567016404 5ustar00nineusers00000000000000Petal-2.25/t/data/html_errors/PaxHeaders.604/not_xml.html0000644000000000000000000000007411714720667020177 xustar0030 atime=1398329060.100463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/html_errors/not_xml.html0000644000175000001440000000010511714720667020750 0ustar00nineusers00000000000000

    This is a broken paragraph. Petal-2.25/t/data/html_errors/PaxHeaders.604/no_var.html0000644000000000000000000000007411714720667020003 xustar0030 atime=1398329060.096463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/html_errors/no_var.html0000644000175000001440000000016611714720667020563 0ustar00nineusers00000000000000

    This is a broken paragraph.

    Petal-2.25/t/data/PaxHeaders.604/nested_modifiers0000644000000000000000000000013213431073567016530 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.145412511 30 ctime=1550088055.157412549 Petal-2.25/t/data/nested_modifiers/0000755000175000001440000000000013431073567017367 5ustar00nineusers00000000000000Petal-2.25/t/data/nested_modifiers/PaxHeaders.604/test1.xml0000644000000000000000000000007411714720667020376 xustar0030 atime=1398329060.136463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/nested_modifiers/test1.xml0000644000175000001440000000003011714720667021144 0ustar00nineusers00000000000000$uc:string Petal-2.25/t/data/nested_modifiers/PaxHeaders.604/test2.xml0000644000000000000000000000007411714720667020377 xustar0030 atime=1398329060.140463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/nested_modifiers/test2.xml0000644000175000001440000000003711714720667021154 0ustar00nineusers00000000000000$encode:uc:string Petal-2.25/t/data/PaxHeaders.604/translate.xml0000644000000000000000000000007411714720667016010 xustar0030 atime=1398329060.084463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/translate.xml0000644000175000001440000000053011714720667016563 0ustar00nineusers00000000000000 Fedora Core 4 RPMs added (RPM, Debug RPM). Petal-2.25/t/data/PaxHeaders.604/basic.xml0000644000000000000000000000007411714720667015074 xustar0030 atime=1398329059.992463569 30 ctime=1550088055.145412511 Petal-2.25/t/data/basic.xml0000644000175000001440000000047211714720667015654 0ustar00nineusers00000000000000 CONDITION LOOP No surrounding tags First Petal-2.25/t/data/PaxHeaders.604/manipulate.html0000644000000000000000000000007411714720667016316 xustar0030 atime=1398329060.048463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/manipulate.html0000644000175000001440000000125211714720667017073 0ustar00nineusers00000000000000 Action Label
    Petal-2.25/t/data/PaxHeaders.604/entities.html0000644000000000000000000000007411714720667016003 xustar0030 atime=1398329060.016463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/entities.html0000644000175000001440000000022011714720667016552 0ustar00nineusers00000000000000 Copyright: © Registered: ® Non-break space:   Petal-2.25/t/data/PaxHeaders.604/metal-fill-slot.html0000644000000000000000000000007411714720667017164 xustar0030 atime=1398329060.052463568 30 ctime=1550088055.145412511 Petal-2.25/t/data/metal-fill-slot.html0000644000175000001440000000042211714720667017737 0ustar00nineusers00000000000000

    Okay, let's test the stuff.

    This is kind of a simple test: Bar

    Petal-2.25/t/data/PaxHeaders.604/benchmark.html0000644000000000000000000000007411714720667016111 xustar0030 atime=1398329059.996463569 30 ctime=1550088055.149412525 Petal-2.25/t/data/benchmark.html0000644000175000001440000000104311714720667016664 0ustar00nineusers00000000000000 Petal Benchmark Page Found bar: $foo/bar
    User ID:$session/user/id
    User Name:$session/user/name
  • list element: $blah
  • Session ID: $session/id Petal-2.25/t/data/PaxHeaders.604/dummy_data.xml0000644000000000000000000000007411714720667016137 xustar0030 atime=1398329060.008463569 30 ctime=1550088055.149412525 Petal-2.25/t/data/dummy_data.xml0000644000175000001440000000031711714720667016715 0ustar00nineusers00000000000000
    dummy dummy Petal-2.25/t/data/PaxHeaders.604/style_andamp.html0000644000000000000000000000007411714720667016637 xustar0030 atime=1398329060.080463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/style_andamp.html0000644000175000001440000000020211714720667017406 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/utf-8.xml0000644000000000000000000000007411714720667014756 xustar0030 atime=1398329060.084463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/utf-8.xml0000644000175000001440000000003511714720667015531 0ustar00nineusers00000000000000

    A copyright © symbol

    Petal-2.25/t/data/PaxHeaders.604/method_param.xml0000644000000000000000000000007411714720667016453 xustar0030 atime=1398329060.056463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/method_param.xml0000644000175000001440000000044711714720667017235 0ustar00nineusers00000000000000 ${cgi/param --t 'foo'} ${cgi/param --b 'foo'} ${cgi/param --ta 'foo'} ${cgi/self_url} ${foo/bar/baz --t -hello} Petal-2.25/t/data/PaxHeaders.604/metal_double_include0000644000000000000000000000013213431073567017344 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.149412525 30 ctime=1550088055.157412549 Petal-2.25/t/data/metal_double_include/0000755000175000001440000000000013431073567020203 5ustar00nineusers00000000000000Petal-2.25/t/data/metal_double_include/PaxHeaders.604/main.xhtml0000644000000000000000000000007411714720667021432 xustar0030 atime=1398329060.132463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/metal_double_include/main.xhtml0000644000175000001440000000024211714720667022205 0ustar00nineusers00000000000000

    Titolo

    Titolo

    Petal-2.25/t/data/metal_double_include/PaxHeaders.604/fragment.xhtml0000644000000000000000000000007411714720667022311 xustar0030 atime=1398329060.128463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/metal_double_include/fragment.xhtml0000644000175000001440000000010511714720667023062 0ustar00nineusers00000000000000 La casa degli spiritosi Petal-2.25/t/data/PaxHeaders.604/interpolate.xml0000644000000000000000000000007411714720667016341 xustar0030 atime=1398329060.040463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/interpolate.xml0000644000175000001440000000017311714720667017117 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/hash_mustfail.xml0000644000000000000000000000007411714720667016642 xustar0030 atime=1398329060.028463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/hash_mustfail.xml0000644000175000001440000000010211714720667017410 0ustar00nineusers00000000000000$object/blargh/bleurgh Petal-2.25/t/data/PaxHeaders.604/hash_mustpass.xml0000644000000000000000000000007411714720667016675 xustar0030 atime=1398329060.032463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/hash_mustpass.xml0000644000175000001440000000007511714720667017454 0ustar00nineusers00000000000000$object/as_string Petal-2.25/t/data/PaxHeaders.604/comment_does_not_die.xml0000644000000000000000000000007411714720667020170 xustar0030 atime=1398329060.000463569 30 ctime=1550088055.149412525 Petal-2.25/t/data/comment_does_not_die.xml0000644000175000001440000000030511714720667020743 0ustar00nineusers00000000000000 Petal / MKDoc::XML bug Hello world! Petal-2.25/t/data/PaxHeaders.604/loop_error.xml0000644000000000000000000000007411714720667016175 xustar0030 atime=1398329060.044463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/loop_error.xml0000644000175000001440000000167611714720667016764 0ustar00nineusers00000000000000-------------------------1------------------------- num=[$num] + num=[$num] chr=[$chr] num=[$num] chr=[$chr] stf=[$stf] - num=[$num] chr=[$chr] -------------------------2------------------------- num=[$num] + num=[$num] chr=[$chr] num=[$num] chr=[$chr] stf=[$stf] - num=[$num] chr=[$chr] -------------------------3------------------------- num=[$num] + num=[$num] chr=[$chr] num=[$num] chr=[$chr] stf=[$stf] - num=[$num] chr=[$chr] Petal-2.25/t/data/PaxHeaders.604/plugin.xml0000644000000000000000000000007411714720667015311 xustar0030 atime=1398329060.068463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/plugin.xml0000644000175000001440000000007311714720667016066 0ustar00nineusers00000000000000BLARGH Petal-2.25/t/data/PaxHeaders.604/hypen.xml0000644000000000000000000000007411714720667015136 xustar0030 atime=1398329060.032463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/hypen.xml0000644000175000001440000000003111714720667015705 0ustar00nineusers00000000000000Hello Petal-2.25/t/data/PaxHeaders.604/set_nested_var.html0000644000000000000000000000007411714720667017164 xustar0030 atime=1398329060.072463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/set_nested_var.html0000644000175000001440000000075711714720667017752 0ustar00nineusers00000000000000 ok: my defined ok: my-test defined ok: my-test-fu defined ok: foo defined ok: foo-1 defined Petal-2.25/t/data/PaxHeaders.604/comments.xml0000644000000000000000000000007411714720667015640 xustar0030 atime=1398329060.000463569 30 ctime=1550088055.149412525 Petal-2.25/t/data/comments.xml0000644000175000001440000000017411714720667016417 0ustar00nineusers00000000000000 Hello, World! Petal-2.25/t/data/PaxHeaders.604/set_modifier0000644000000000000000000000013213431073567015656 xustar0030 mtime=1550088055.149412525 30 atime=1550088055.149412525 30 ctime=1550088055.149412525 Petal-2.25/t/data/set_modifier/0000755000175000001440000000000013431073567016515 5ustar00nineusers00000000000000Petal-2.25/t/data/set_modifier/PaxHeaders.604/index.xml0000644000000000000000000000007411714720667017573 xustar0030 atime=1398329060.152463567 30 ctime=1550088055.149412525 Petal-2.25/t/data/set_modifier/index.xml0000644000175000001440000000016311714720667020350 0ustar00nineusers00000000000000 * title : $title * settest : $settest Petal-2.25/t/data/PaxHeaders.604/path_prefix.xml0000644000000000000000000000007411714720667016324 xustar0030 atime=1398329060.068463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/path_prefix.xml0000644000175000001440000000004711714720667017102 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/tests_with_zero.xml0000644000000000000000000000007411714720667017247 xustar0030 atime=1398329060.080463568 30 ctime=1550088055.149412525 Petal-2.25/t/data/tests_with_zero.xml0000644000175000001440000000025311714720667020024 0ustar00nineusers00000000000000 yo replace: yoyo Petal-2.25/t/data/PaxHeaders.604/hashref_list.html0000644000000000000000000000007411714720667016632 xustar0030 atime=1398329060.032463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/hashref_list.html0000644000175000001440000000022711714720667017410 0ustar00nineusers00000000000000 field_name field_value Petal-2.25/t/data/PaxHeaders.604/latin1.xml0000644000000000000000000000007411714720667015203 xustar0030 atime=1398329060.044463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/latin1.xml0000644000175000001440000000003411714720667015755 0ustar00nineusers00000000000000

    A copyright © symbol

    Petal-2.25/t/data/PaxHeaders.604/notfalse.xml0000644000000000000000000000007411714720667015626 xustar0030 atime=1398329060.064463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/notfalse.xml0000644000175000001440000000100511714720667016377 0ustar00nineusers00000000000000 Test A Test B Test C Test D Test E Test F Test G Test H Petal-2.25/t/data/PaxHeaders.604/string_count.html0000644000000000000000000000007411714720667016675 xustar0030 atime=1398329060.076463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/string_count.html0000644000175000001440000000041511714720667017452 0ustar00nineusers00000000000000
    • - -
    Petal-2.25/t/data/PaxHeaders.604/test_attributes2.xml0000644000000000000000000000007411714720667017322 xustar0030 atime=1398329060.080463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_attributes2.xml0000644000175000001440000000113411714720667020076 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/access_obj_hash.html0000644000000000000000000000007411714720667017255 xustar0030 atime=1398329059.988463569 30 ctime=1550088055.153412537 Petal-2.25/t/data/access_obj_hash.html0000644000175000001440000000011611714720667020030 0ustar00nineusers00000000000000 ok: bar Petal-2.25/t/data/PaxHeaders.604/quoted_params.xml0000644000000000000000000000007411714720667016657 xustar0030 atime=1398329060.072463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/quoted_params.xml0000644000175000001440000000011611714720667017432 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/content_encoded.html0000644000000000000000000000007411714720667017312 xustar0030 atime=1398329060.000463569 30 ctime=1550088055.153412537 Petal-2.25/t/data/content_encoded.html0000644000175000001440000000012311714720667020063 0ustar00nineusers00000000000000

    Stuff_To_Replace

    Petal-2.25/t/data/PaxHeaders.604/test_attributes_chars0000644000000000000000000000013213431073567017612 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.153412537 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_attributes_chars/0000755000175000001440000000000013431073567020451 5ustar00nineusers00000000000000Petal-2.25/t/data/test_attributes_chars/PaxHeaders.604/test_attributes_chars1.xml0000644000000000000000000000007411714720667025106 xustar0030 atime=1398329060.152463567 30 ctime=1550088055.153412537 Petal-2.25/t/data/test_attributes_chars/test_attributes_chars1.xml0000644000175000001440000000022111714720667025656 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/string.xml0000644000000000000000000000007411714720667015321 xustar0030 atime=1398329060.076463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/string.xml0000644000175000001440000000016711714720667016102 0ustar00nineusers00000000000000

    Blaaaargh.

    Petal-2.25/t/data/PaxHeaders.604/autoload.xml0000644000000000000000000000007411714720667015623 xustar0030 atime=1398329059.992463569 30 ctime=1550088055.153412537 Petal-2.25/t/data/autoload.xml0000644000175000001440000000006411714720667016400 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/xhtml.html0000644000000000000000000000007411714720667015313 xustar0030 atime=1398329060.084463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/xhtml.html0000644000175000001440000000034411714720667016071 0ustar00nineusers00000000000000

    This is a paragraph, it's got a linebreak.
    Cool huh?


    Petal-2.25/t/data/PaxHeaders.604/error_on_undef_var.html0000644000000000000000000000007411714720667020035 xustar0030 atime=1398329060.020463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/error_on_undef_var.html0000644000175000001440000000014111714720667020606 0ustar00nineusers00000000000000 not ok: if evaluated to true!? ok: did not die Petal-2.25/t/data/PaxHeaders.604/cookbook.html0000644000000000000000000000007411714720667015765 xustar0030 atime=1398329060.004463569 30 ctime=1550088055.153412537 Petal-2.25/t/data/cookbook.html0000644000175000001440000000456011714720667016547 0ustar00nineusers00000000000000 Petal Test

    Petal Test

    Basic - Passing a hashreference to Petal::process

    No elements
    $rec/foo

    String

    #

    foo

    Advanced - Invoking methods on objects

    ID Name Phone Active
    No elements
    ID First Last Phone x
    • Current id

    Advanced - Using CGI.pm to generate forms

    Checkbox group Select group Radio button group
    Test Test Test
    Petal-2.25/t/data/PaxHeaders.604/access_obj_array.html0000644000000000000000000000007411714720667017450 xustar0030 atime=1398329059.984463569 30 ctime=1550088055.153412537 Petal-2.25/t/data/access_obj_array.html0000644000175000001440000000012011714720667020216 0ustar00nineusers00000000000000 ok: index 0 Petal-2.25/t/data/PaxHeaders.604/entities.xml0000644000000000000000000000007411714720667015637 xustar0030 atime=1398329060.016463568 30 ctime=1550088055.153412537 Petal-2.25/t/data/entities.xml0000644000175000001440000000003011714720667016405 0ustar00nineusers00000000000000< @ Petal-2.25/t/data/PaxHeaders.604/canonical_error.html0000644000000000000000000000007411714720667017317 xustar0030 atime=1398329059.996463569 30 ctime=1550088055.153412537 Petal-2.25/t/data/canonical_error.html0000644000175000001440000000061011714720667020071 0ustar00nineusers00000000000000

    The Non-Working Tests

    Canonical tag error in XHTML parser

    Errors occur when trying to use the canonical format in templates parsed by the XHTML parser.

    • -
    Petal-2.25/t/data/PaxHeaders.604/decl.xml0000644000000000000000000000007411714720667014722 xustar0030 atime=1398329060.004463569 30 ctime=1550088055.157412549 Petal-2.25/t/data/decl.xml0000644000175000001440000000036411714720667015502 0ustar00nineusers00000000000000 Hello, World Petal-2.25/t/data/PaxHeaders.604/split_expression.xml0000644000000000000000000000007411714720667017425 xustar0030 atime=1398329060.076463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/split_expression.xml0000644000175000001440000000010111714720667020172 0ustar00nineusers00000000000000

    Hello, World

    Petal-2.25/t/data/PaxHeaders.604/dollarone-again.xml0000644000000000000000000000007411714720667017047 xustar0030 atime=1398329060.008463569 30 ctime=1550088055.157412549 Petal-2.25/t/data/dollarone-again.xml0000644000175000001440000000020711714720667017623 0ustar00nineusers00000000000000

    Here be stuff

    Petal-2.25/t/data/PaxHeaders.604/attribute_strip.html0000644000000000000000000000007411714720667017403 xustar0030 atime=1398329059.988463569 30 ctime=1550088055.157412549 Petal-2.25/t/data/attribute_strip.html0000644000175000001440000000006411714720667020160 0ustar00nineusers00000000000000 Petal-2.25/t/data/PaxHeaders.604/oddeven.xml0000644000000000000000000000007411714720667015437 xustar0030 atime=1398329060.064463568 30 ctime=1550088055.157412549 Petal-2.25/t/data/oddeven.xml0000644000175000001440000000043711714720667016220 0ustar00nineusers00000000000000 Odd item Even item Petal-2.25/t/data/PaxHeaders.604/delete_attribute.xml0000644000000000000000000000007411714720667017340 xustar0030 atime=1398329060.004463569 30 ctime=1550088055.157412549 Petal-2.25/t/data/delete_attribute.xml0000644000175000001440000000017011714720667020113 0ustar00nineusers00000000000000 Petal-2.25/t/PaxHeaders.604/086_lang_include_diskcache.t0000644000000000000000000000007411714720667017564 xustar0030 atime=1398329059.968463569 30 ctime=1550088055.137412486 Petal-2.25/t/086_lang_include_diskcache.t0000644000175000001440000000272111714720667020343 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'language' option (and 'lang' alias) to Petal->new. # Uses t/data/language/* # # this is identical to t/052_Opt_language but with DISK_CACHE=1 use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; use File::Spec; $Petal::DISK_CACHE = 1; $Petal::MEMORY_CACHE = 0; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'language'; my @args = ( replace => 'Replacement Text', content => 'Content Here', attribute => 'An attribute', elements => [ 'one', 'two' ], ); # Try processing a template with a language and an include my $template = new Petal (file => $file, base_dir => $data_dir, language => 'fr'); is($template->language, 'fr', 'correct language requested (fr)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "template with language and includes successfully processed"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr\)\s+

    }x, "output is correct"); # Same again but using 'lang' option alias $template = new Petal (file => $file, base_dir => $data_dir, lang => 'fr-CA'); is($template->language, 'fr-CA', 'correct language requested (fr-CA)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "template with lang and includes successfully processed"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr-CA\)\s+

    }x, "output is correct"); Petal-2.25/t/PaxHeaders.604/005_If_Nested_Tag.t0000644000000000000000000000007311714720667015563 xustar0029 atime=1398329059.86846357 30 ctime=1550088055.137412486 Petal-2.25/t/005_If_Nested_Tag.t0000644000175000001440000000061311714720667016341 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'if.xml'; my $template = new Petal ($template_file); unlike ($template->process, qr/\/); like ($template->process (error => 'Some error message'), qr/Some error message/); Petal-2.25/t/PaxHeaders.604/041_Entities.t0000644000000000000000000000007411714720667014715 xustar0030 atime=1398329059.932463569 30 ctime=1550088055.137412486 Petal-2.25/t/041_Entities.t0000644000175000001440000000141311714720667015471 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::DECODE_CHARSET = 'UTF-8'; $Petal::ENCODE_CHARSET = 'UTF-8'; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::INPUT = 'XHTML'; $Petal::OUTPUT = 'XHTML'; ok (1); if ($] > 5.007) { my $string = Petal->new ( 'entities.html' )->process(); my $copy = chr (169); my $reg = chr (174); my $nbsp = chr (160); my $acirc = chr (194); like ($string, qr/$copy/ => 'Copyright'); like ($string, qr/$reg/ => 'Registered'); like ($string, qr/$nbsp/ => 'Non-break space'); unlike ($string, qr/$acirc/ => 'A circumflex not present'); } Petal-2.25/t/PaxHeaders.604/018_String_Count.t0000644000000000000000000000007411714720667015553 xustar0030 atime=1398329059.896463569 30 ctime=1550088055.137412486 Petal-2.25/t/018_String_Count.t0000644000175000001440000000151711714720667016334 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'string_count.html'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $hash = { error_message => "Kilroy was Here", first_name => "William", last_name => "McKee", email => 'william@knowmad.com', students => [ { student_id => '1', first_name => 'William', last_name => 'McKee', email => 'william@knowmad.com', }, { student_id => '2', first_name => 'Elizabeth', last_name => 'McKee', email => 'elizabeth@knowmad.com', }, ], }; # warn $template->_code_with_line_numbers(); my $html = $template->process($hash); like($html, '/1 - William/'); like($html, '/2 - Elizabeth/'); Petal-2.25/t/PaxHeaders.604/012_Prefix.t0000644000000000000000000000007411714720667014364 xustar0030 atime=1398329059.888463569 30 ctime=1550088055.137412486 Petal-2.25/t/012_Prefix.t0000644000175000001440000000052711714720667015145 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('prefix.xml'); my $string = $template->process; like ($string, qr//); like ($string, qr/<\/some:stuff>/); Petal-2.25/t/PaxHeaders.604/002_Set_Modifier.t0000644000000000000000000000007311714720667015476 xustar0029 atime=1398329059.86446357 30 ctime=1550088055.137412486 Petal-2.25/t/002_Set_Modifier.t0000644000175000001440000000064511714720667016261 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/set_modifier'; $Petal::MEMORY_CACHE = 0; $Petal::DISK_CACHE = 0; my $petal = new Petal ('index.xml'); my $res = $petal->process ( title => '__TAG__', settest => 'blah' ); # test that we have __TAG__ twice my @capture = ($res =~ /(__TAG__)/g); is (scalar @capture,2); 1; __END__ Petal-2.25/t/PaxHeaders.604/025_Omit_Tag.t0000644000000000000000000000007411714720667014636 xustar0030 atime=1398329059.904463569 30 ctime=1550088055.137412486 Petal-2.25/t/025_Omit_Tag.t0000644000175000001440000000123311714720667015412 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'omit-tag.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $string = $template->process(); like($string, '/This tag should not be omited/', "XML - XML preserve"); unlike($string, '/This tag should be omited/', "XML - XML omit"); $Petal::OUTPUT = "XHTML"; $string = $template->process(); like($string, '/This tag should not be omited/', "XML - XHTML preserve"); unlike($string, '/This tag should be omited/', "XML - XHTML omit"); 1; Petal-2.25/t/PaxHeaders.604/006_Split_Expression.t0000644000000000000000000000007311714720667016443 xustar0029 atime=1398329059.87246357 30 ctime=1550088055.137412486 Petal-2.25/t/006_Split_Expression.t0000644000175000001440000000053211714720667017221 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'split_expression.xml'; my $template = new Petal ($template_file); like ($template->process (foo => 1, bar => 1), qr/Hello/); Petal-2.25/t/PaxHeaders.604/014_Interpolate.t0000644000000000000000000000007411714720667015417 xustar0030 atime=1398329059.888463569 30 ctime=1550088055.137412486 Petal-2.25/t/014_Interpolate.t0000644000175000001440000000055111714720667016175 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('interpolate.xml'); my $string = $template->process ( first_name => 'Aurelia', last_name => 'Fernandez' ); unlike ($string, qr/\<\?/); Petal-2.25/t/PaxHeaders.604/021_Canonical_Error.t0000644000000000000000000000007411714720667016167 xustar0030 atime=1398329059.900463569 30 ctime=1550088055.137412486 Petal-2.25/t/021_Canonical_Error.t0000644000175000001440000000140511714720667016744 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'canonical_error.html'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $hash = { error_message => "Kilroy was Here", first_name => "William", last_name => "McKee", email => 'william@knowmad.com', students => [ { student_id => '1', first_name => 'William', last_name => 'McKee', email => 'william@knowmad.com', }, { student_id => '2', first_name => 'Elizabeth', last_name => 'McKee', email => 'elizabeth@knowmad.com', }, ], }; eval { $template->process($hash) }; ok (!$@); $Petal::OUTPUT = "HTML"; ok (!$@); Petal-2.25/t/PaxHeaders.604/027_Eval.t0000644000000000000000000000007411714720667014024 xustar0030 atime=1398329059.908463569 30 ctime=1550088055.141412499 Petal-2.25/t/027_Eval.t0000644000175000001440000000104311714720667014577 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'eval.xml'; my $template = new Petal ($template_file); my $string = $template->process; like( $string, qr/should\s+appear/, 'should appear (XML out)' ); like( $string, qr/booo/, 'booo (XML out)' ); unlike( $string, qr/should\s+not\s+appear/, 'should not appear (XML out)' ); __END__ Petal-2.25/t/PaxHeaders.604/054_Opt_cache.t0000644000000000000000000000007411714720667015022 xustar0030 atime=1398329059.944463569 30 ctime=1550088055.141412499 Petal-2.25/t/054_Opt_cache.t0000644000175000001440000000463311714720667015605 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'disk_cache' and 'memory_cache' options to Petal->new. # use Test::More tests => 12; use warnings; use lib 'lib'; use Petal; use File::Spec; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'if.html'; # Confirm disk cache defaults to on my $template = new Petal (file => $file, base_dir => $data_dir); ok($template->disk_cache, "disk_cache defaults to on"); # Confirm option can disable it $template = new Petal (file => $file, base_dir => $data_dir, disk_cache => 0); ok(!$template->disk_cache, "disk_cache option turns it off"); # Confirm global can disable it $Petal::DISK_CACHE = 0; $template = new Petal (file => $file, base_dir => $data_dir); ok(!$template->disk_cache, "\$Petal::DISK_CACHE turns it off"); # Confirm option can enable it $template = new Petal (file => $file, base_dir => $data_dir, disk_cache => 1); ok($template->disk_cache, "disk_cache option turns it on again"); # Confirm memory cache defaults to on $template = new Petal (file => $file, base_dir => $data_dir); ok($template->memory_cache, "memory_cache defaults to on"); # Confirm option can disable it $template = new Petal (file => $file, base_dir => $data_dir, memory_cache => 0); ok(!$template->memory_cache, "memory_cache option turns it off"); # Confirm global can disable it $Petal::MEMORY_CACHE = 0; $template = new Petal (file => $file, base_dir => $data_dir); ok(!$template->memory_cache, "\$Petal::MEMORY_CACHE turns it off"); # Confirm option can enable it $template = new Petal (file => $file, base_dir => $data_dir, memory_cache => 1); ok($template->memory_cache, "memory_cache option turns it on again"); # Confirm cache_only defaults to off $template = new Petal (file => $file, base_dir => $data_dir); ok(!$template->cache_only, "cache_only defaults to off"); # Confirm option can enable it $template = new Petal (file => $file, base_dir => $data_dir, cache_only => 1); ok($template->cache_only, "cache_only option turns it on"); # Confirm global can enable it $Petal::CACHE_ONLY = 1; $template = new Petal (file => $file, base_dir => $data_dir); ok($template->cache_only, "\$Petal::CACHE_ONLY turns it on"); # Confirm option can disable it $template = new Petal (file => $file, base_dir => $data_dir, cache_only => 0); ok(!$template->cache_only, "cache_only option turns it off again"); Petal-2.25/t/PaxHeaders.604/087_dollar_one.t0000644000000000000000000000007411714720667015261 xustar0030 atime=1398329059.968463569 30 ctime=1550088055.141412499 Petal-2.25/t/087_dollar_one.t0000644000175000001440000000074011714720667016037 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; my $template = new Petal ('dollar-one.xml'); my $string = $template->process; like ($string, qr|\$|); like ($string, qr|\$\$|); like ($string, qr|\$_|); like ($string, qr||); like ($string, qr||); like ($string, qr|\$@|); like ($string, qr|\$1|); Petal-2.25/t/PaxHeaders.604/008_Quoted_Params.t0000644000000000000000000000007311714720667015677 xustar0029 atime=1398329059.87246357 30 ctime=1550088055.141412499 Petal-2.25/t/008_Quoted_Params.t0000644000175000001440000000067011714720667016460 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; package Foo; sub param { return $_[1] }; package main; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('quoted_params.xml'); my $cgi = bless {}, 'Foo'; eval { my $string = $template->process ( cgi => $cgi ); }; ok(! (defined $@ and $@), "ran") || diag $@; Petal-2.25/t/PaxHeaders.604/004_Misc_Tests.t0000644000000000000000000000007311714720667015204 xustar0029 atime=1398329059.86846357 30 ctime=1550088055.141412499 Petal-2.25/t/004_Misc_Tests.t0000644000175000001440000000107611714720667015766 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/multiple_includes/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'test.tmpl'; my $template = new Petal ($template_file); my $hash = { first_name => "William", last_name => "McKee", last => "Boo", email => 'william@knowmad.com', }; like ($template->process ($hash), qr/william\@knowmad.com/); unlike ($template->process ($hash), qr/Boo/); unlike ($template->process ($hash), qr/McKee_opposite/); Petal-2.25/t/PaxHeaders.604/001_Include.t0000644000000000000000000000007311714720667014507 xustar0029 atime=1398329059.86046357 30 ctime=1550088055.141412499 Petal-2.25/t/001_Include.t0000644000175000001440000000237111714720667015270 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More tests => 8; use Petal; sub nowarnings { $Petal::MEMORY_CACHE && $Petal::DISK_CACHE }; $Petal::BASE_DIR = './t/data/include'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; my $petal = new Petal ('index.xml'); unlike(${$petal->_canonicalize()}, '/World""/', "canonicalise"); like($petal->process, '/__INCLUDED__/', "find marker"); unlike($petal->process, '/__INCLUDED__\s+<\/body>/', "find marker and tag"); like($petal->process, '/Hello, "World"/', "find hello"); { $Petal::OUTPUT = "XML"; $petal = new Petal ('index_xinclude.xml'); like($petal->process, '/__INCLUDED__/', "MTB - XML find included"); $Petal::OUTPUT = "XHTML"; $petal = new Petal ('index_xinclude.xml'); like($petal->process, '/__INCLUDED__/', "MTB - XHTML find included"); } $Petal::BASE_DIR = './t/data/include/deep'; eval { $Petal::OUTPUT = "XML"; $petal = new Petal ('index.xml'); $petal->process; }; like($@, '/Cannot go above base directory/', "correct error"); $Petal::BASE_DIR = './t/data/include'; { $Petal::OUTPUT = "XML"; $petal = new Petal ('deep/index.xml'); like($petal->process, '/__INCLUDED__/', "deep find included"); } 1; __END__ Petal-2.25/t/PaxHeaders.604/052_Opt_language.t0000644000000000000000000000007411714720667015540 xustar0030 atime=1398329059.940463569 30 ctime=1550088055.141412499 Petal-2.25/t/052_Opt_language.t0000644000175000001440000000355111714720667016321 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'language' option (and 'lang' alias) to Petal->new. # Uses t/data/language/* # use Test::More tests => 9; use warnings; use lib 'lib'; use Petal; use File::Spec; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'language'; my @args = ( replace => 'Replacement Text', content => 'Content Here', attribute => 'An attribute', elements => [ 'one', 'two' ], ); # Try processing a template with a language and an include my $template = new Petal (file => $file, base_dir => $data_dir, language => 'fr'); is($template->language, 'fr', 'correct language requested (fr)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "template with language and includes successfully processed"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr\)\s+

    }x, "output is correct"); # Same again but using 'lang' option alias $template = new Petal (file => $file, base_dir => $data_dir, lang => 'fr-CA'); is($template->language, 'fr-CA', 'correct language requested (fr-CA)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "template with lang and includes successfully processed"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr-CA\)\s+

    }x, "output is correct"); # Change default language and try requesting a non-existant language $Petal::LANGUAGE = 'fr'; $template = new Petal (file => $file, base_dir => $data_dir, lang => 'zh'); is($template->language, 'zh', 'correct language requested (zh)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "default language successfully used to select template"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr\)\s+

    }x, "output is correct"); Petal-2.25/t/PaxHeaders.604/028_Infinite_Includes.t0000644000000000000000000000007411714720667016531 xustar0030 atime=1398329059.908463569 30 ctime=1550088055.141412499 Petal-2.25/t/028_Infinite_Includes.t0000644000175000001440000000053411714720667017310 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'infinite_includes.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $string = $template->process(); like ($string => qr/ERROR/); Petal-2.25/t/PaxHeaders.604/026_Broken_Loop.t0000644000000000000000000000007411714720667015345 xustar0030 atime=1398329059.904463569 30 ctime=1550088055.141412499 Petal-2.25/t/026_Broken_Loop.t0000644000175000001440000000223311714720667016122 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $data_dir = 't/data'; my $file = 'children.xml'; my $child1 = { dir => 'ltr', lang => 'en', 'xml:lang' => 'en', uri => 'foo/', direction => 'ltr', title => 'Foo' }; my $child2 = { dir => 'ltr', lang => 'en', 'xml:lang' => 'en', uri => 'bar/', direction => 'ltr', title => 'Bar' }; my $child3 = { dir => 'ltr', lang => 'en', 'xml:lang' => 'en', uri => 'baz/', direction => 'ltr', title => 'Baz' }; my @args = ( self => { children => [ $child1, $child2, $child3 ] } ); my $template = new Petal (base_dir => $data_dir, file => $file); my $result = $template->process (@args); like ($result, qr/foo/ => 'contains foo'); like ($result, qr/bar/ => 'contains bar'); like ($result, qr/baz/ => 'contains baz'); like ($result, qr/Foo/ => 'contains Foo'); like ($result, qr/Bar/ => 'contains Bar'); like ($result, qr/Baz/ => 'contains Baz'); Petal-2.25/t/PaxHeaders.604/029_Test_NS_Attributes.t0000644000000000000000000000007411714720667016664 xustar0030 atime=1398329059.908463569 30 ctime=1550088055.141412499 Petal-2.25/t/029_Test_NS_Attributes.t0000644000175000001440000000472511714720667017451 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = './t/data/test_ns_attributes/'; my $template; ##### $Petal::NS = "petal"; $template = new Petal('test_rightWayOfDoing.xml'); my $string = $template->process (baz_value => 'baz_value'); like ($string => qr/baz_value/); ##### $Petal::NS = "petal"; $template = new Petal('test_ns_attributes1.xml'); $string = $template->process ( baz_value => 'Replaced baz', buzz_value => 'Replaced buzz' ); like ($string => qr/Replaced baz/); like ($string => qr/Replaced buzz/); ##### $template = new Petal('test_ns_attributes2.xml'); $string = $template->process( baz_value => 'Replaced baz', buzz_value => 'Replaced buzz' ); like ($string => qr/Replaced baz/); like ($string => qr/Replaced buzz/); ##### $Petal::NS = "petal-temp"; $template = new Petal('test_ns_attributes3.xml'); $string = $template->process ( baz_value => 'Replaced baz', buzz_value => 'Replaced buzz' ); like ($string => qr/Replaced baz/); like ($string => qr/Replaced buzz/); ##### $Petal::NS = "petal_temp"; $Petal::NS_URI = "urn:pepsdesign.com:petal:temp"; $template = new Petal('test_ns_attributes4.xml'); $string = $template->process(baz_value => 'baz_value'); like ($string => qr/baz_value/); ##### $Petal::NS = "petal-temp"; $Petal::NS_URI = "urn:pepsdesign.com:petal:temp"; $template = new Petal('test_ns_attributes5.xml'); $string = $template->process(baz_value => 'baz_value'); like ($string => qr/baz_value/); # Replacing multiple attributes... $Petal::NS = "petal_temp"; $Petal::NS_URI = "urn:pepsdesign.com:petal:temp"; $template = new Petal ('test_ns_attributes6.xml'); $string = $template->process ( baz_data => 'baz_value', buzz_data => 'buzz_value', quxx_data => 'quxx_value', SC => ';' ); like ($string => qr/baz_value/); like ($string => qr/buzz_value/); like ($string => qr/quxx_value/); like ($string => qr/;/); # Replacing multiple attributes... $Petal::NS = "petal-temp"; $Petal::NS_URI = "urn:pepsdesign.com:petal:temp"; $template = new Petal('test_ns_attributes7.xml'); $string = $template->process ( baz_data => 'baz_value', buzz_data => 'buzz_value', quxx_data => 'quxx_value', SC => ';' ); like ($string => qr/baz_value/); like ($string => qr/buzz_value/); like ($string => qr/quxx_value/); like ($string => qr/;/); 1; __END__ Petal-2.25/t/PaxHeaders.604/055_Opt_maxinc.t0000644000000000000000000000007411714720667015237 xustar0030 atime=1398329059.944463569 30 ctime=1550088055.141412499 Petal-2.25/t/055_Opt_maxinc.t0000644000175000001440000000506511714720667016022 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'max_includes' option to Petal->new. # use Test::More tests => 10; use warnings; use lib 'lib'; use Petal; use File::Spec; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'if.xml'; my @args = ( error => 'Altitude too low!', ); # Confirm max_includes defaults to 30 my $template = new Petal (file => $file, base_dir => $data_dir); is($template->max_includes, 30, "max_includes defaults to 30"); # Confirm option can change it $template = new Petal (file => $file, base_dir => $data_dir, max_includes => 5); is($template->max_includes, 5, "max_includes option changes it"); # Confirm global also changes it $Petal::MAX_INCLUDES = 20; $template = new Petal (file => $file, base_dir => $data_dir); is($template->max_includes, 20, "\$Petal::MAX_INCLUDES changes it too"); # Confirm option can override changed global $template = new Petal (file => $file, base_dir => $data_dir, max_includes => 0); is($template->max_includes, 0, "max_includes option overrides changed global"); =cut # Check the value passed to included templates my $options = $template->include_opts; my $ref = eval "my \$hashref = { $options }"; ok(!$@, "extracted params for included template"); is($ref->{max_includes}, -1, "correct value for max_includes option"); =cut # Confirm that template with no includes is processed $@ = ''; $output = eval { $template->process(@args); }; is($@, '', "template with no includes processed successfully"); like($output, qr{^\s*
    \s* Altitude\stoo\slow!

    \s*
    }x, "output is correct"); # Process a template with includes $data_dir = File::Spec->catdir('t', 'data', 'include'); $file = 'index_xinclude.xml'; @args = (); $template = new Petal (file => $file, base_dir => $data_dir, max_includes => 1, input => 'XML', output => 'XML'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "Template with includes successfully processed"); like($output, qr{^\s* \s+
    \s+

    __INCLUDED__

    \s+

    __INCLUDED__

    \s+

    \s+
    \s+
    }x, "Output is correct"); # Try again but with reduced max_includes setting $template = new Petal (file => $file, base_dir => $data_dir, max_includes => 0, input => 'XML', output => 'XML'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "Template with includes successfully processed"); like($output, qr{ERROR:\s+MAX_INCLUDES}x, "Output is correct"); Petal-2.25/t/PaxHeaders.604/017_Entities.t0000644000000000000000000000007411714720667014720 xustar0030 atime=1398329059.892463569 30 ctime=1550088055.141412499 Petal-2.25/t/017_Entities.t0000644000175000001440000000045711714720667015503 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('entities.xml'); my $string = $template->process; like ($string, qr/\<\;/); Petal-2.25/t/PaxHeaders.604/050_Opt_base_dir.t0000644000000000000000000000007411714720667015523 xustar0030 atime=1398329059.940463569 30 ctime=1550088055.141412499 Petal-2.25/t/050_Opt_base_dir.t0000644000175000001440000000632211714720667016303 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'data_dir' option to Petal->new and related functionality. # Uses t/data/namespaces.xml and t/data/include/index_xinclude.xml # use Test::More tests => 16; use warnings; use lib 'lib'; use Petal; use File::Spec; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'namespaces.xml'; my @args = ( replace => 'Replacement Text', content => 'Content Here', attribute => 'An attribute', elements => [ 'one', 'two' ], ); # Test template not found if path not specified my $template = new Petal (file => $file); is_deeply([ $template->base_dir ], [ '.' ], "\@Petal::BASE_DIR is used as default base_dir"); $@ = ''; my $output = eval { $template->process(@args); }; ok($@, "Template not found (as expected)"); like($@, qr{ Cannot\sfind\snamespaces\.xml\sin }x, "Error message is correct"); # Confirm $Petal::BASE_DIR used as default if defined { local($Petal::BASE_DIR) = 'dummy_dir'; $template = new Petal (file => $file); ok (1); # is_deeply([ $template->base_dir ], [ 'dummy_dir', '.' ], # "\$Petal::BASE_DIR is in default base_dir"); $@ = ''; $output = eval { $template->process(@args); }; ok($@, "Template still not found (as expected)"); like($@, qr{ Cannot\sfind\snamespaces\.xml\sin }x, "Error message is correct"); } # Confirm base_dir option as arrayref works $template = new Petal (file => $file, base_dir => ['dummy1', 'dummy2']); is_deeply([ $template->base_dir ], [ 'dummy1', 'dummy2' ], "base_dir option specified as arrayref works"); $@ = ''; $output = eval { $template->process(@args); }; ok($@, "Template still not found (as expected)"); like($@, qr{ Cannot\sfind\snamespaces\.xml\sin }x, "Error message is correct"); # Confirm base_dir option as scalar works $template = new Petal (file => $file, base_dir => 'dummy'); is_deeply([ $template->base_dir ], [ 'dummy' ], "base_dir option specified as scalar works"); $@ = ''; $output = eval { $template->process(@args); }; ok($@, "Template still not found (as expected)"); like($@, qr{ Cannot\sfind\snamespaces\.xml\sin }x, "Error message is correct"); # Now specify a valid base_dir option and process a template $template = new Petal (file => $file, base_dir => $data_dir); $@ = ''; $output = eval { $template->process(@args); }; ok(!$@, "Template was found"); like($output, qr{^\s* \s+ Replacement\sText\s+ Content\sHere

    \s+ yo

    \s+
      \s*
    • one
    • \s*
    • two
    • \s*
    \s+ }x, "Output is correct"); # Try processing a template with an include (data_dir is required for included # template too). $data_dir = File::Spec->catdir('t', 'data', 'include'); $file = 'index_xinclude.xml'; $template = new Petal (file => $file, base_dir => $data_dir); $@ = ''; $output = eval { $template->process(@args); }; ok(!$@, "Template with includes successfully processed"); like($output, qr{^\s* \s+
    \s+

    __INCLUDED__

    \s+

    __INCLUDED__

    \s+

    \s+
    \s+
    }x, "Output is correct"); Petal-2.25/t/PaxHeaders.604/016_Method_Param.t0000644000000000000000000000007411714720667015473 xustar0030 atime=1398329059.892463569 30 ctime=1550088055.145412511 Petal-2.25/t/016_Method_Param.t0000644000175000001440000000155011714720667016251 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; package Foo; our $OK = 1; sub bar { my $self = shift; if (scalar @_) { $OK = 0 } return $self; } sub baz { my $self = shift; return $self; } package main; use warnings; use lib ('lib'); use Test::More; BEGIN { eval "use CGI"; plan skip_all => "CGI required" if $@; plan 'no_plan'; } use Petal; $|=1; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $cgi = CGI->new(); $cgi->param ('mbox', 'foo'); my $template = new Petal ('method_param.xml'); my $string = $template->process ( cgi => $cgi, foo => bless {}, 'Foo' ); like( $string, qr/foo/, 'foo' ); like( $string, qr/mbox=foo/, 'mbox=foo' ); like( $string, qr/t=foo/, 't=foo' ); like( $string, qr/b=foo/, 'b=foo' ); like( $string, qr/ta=foo/, 'ta=foo' ); Petal-2.25/t/PaxHeaders.604/094_notfalse.t0000644000000000000000000000007411714720667014754 xustar0030 atime=1398329059.980463569 30 ctime=1550088055.145412511 Petal-2.25/t/094_notfalse.t0000644000175000001440000000126711714720667015537 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'notfalse.xml'; my $template = new Petal ($template_file); my $string = $template->process (always_false => 0, always_true => 1); like ($string, qr/A/, 'test A'); unlike ($string, qr/B/, 'test B'); like ($string, qr/C/, 'test C'); unlike ($string, qr/D/, 'test D'); unlike ($string, qr/E/, 'test E'); like ($string, qr/F/, 'test F'); unlike ($string, qr/G/, 'test G'); like ($string, qr/H/, 'test H'); __END__ Petal-2.25/t/PaxHeaders.604/038_Pass_Variables.t0000644000000000000000000000007411714720667016035 xustar0030 atime=1398329059.928463569 30 ctime=1550088055.145412511 Petal-2.25/t/038_Pass_Variables.t0000644000175000001440000000461111714720667016614 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/pass_variables'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $string; my $vars = { test => bless({}, 'Test'), foo => bless({}, 'Foo') }; $string = Petal->new( 'replace.html' )->process( $vars ); like( $string, qr/Object 0: Foo/, "foo (petal:replace)" ); like( $string, qr/Object 1: Foo/, "foo (petal:replace)" ); like( $string, qr/Object 2: Bar/, "bar (petal:replace)" ); like( $string, qr/Object 3: Foo/, "foo (?var?)" ); like( $string, qr/Object 4: Bar/, "bar (?var?)" ); #diag( $string ); $string = Petal->new( 'content.html' )->process( $vars ); like( $string, qr/Object 0: .+?Foo/, "foo (petal:content)" ); like( $string, qr/Object 1: .+?Foo/, "foo (petal:content)" ); like( $string, qr/Object 2: .+?Bar/, "bar (petal:content)" ); #diag( $string ); $string = Petal->new( 'set.html' )->process( $vars ); like( $string, qr/Object 0: Foo/, "foo (petal:set)" ); like( $string, qr/Object 1: Foo/, "foo (petal:set)" ); like( $string, qr/Object 2: Foo/, "foo (?var set:?)" ); #diag( $string ); $string = Petal->new( 'if.html' )->process( $vars ); like( $string, qr/Object 0: Foo/, "foo (petal:if)" ); like( $string, qr/Object 1: Foo/, "foo (petal:if)" ); like( $string, qr/Object 2: Foo/, "foo (?if?)" ); #diag( $string ); $string = Petal->new( 'attributes.html' )->process( $vars ); like( $string, qr/Object 0: .+?Foo/, "foo (petal:attributes)" ); like( $string, qr/Object 1: .+?Foo/, "foo (petal:attributes)" ); like( $string, qr/Object 2: .+?Bar/, "bar (petal:attributes)" ); #diag( $string ); $string = Petal->new( 'repeat.html' )->process( $vars ); like( $string, qr/Object 1: Foo/, "baz (petal:if)" ); like( $string, qr/Object 2: Foo/, "baz (petal:if)" ); #diag( $string ); $string = Petal->new( 'no_arguments.html' )->process( $vars ); like( $string, qr/No arguments passed/, "no args passed" ); #diag( $string ); package Test; sub object_type { my $self = shift; my $obj = shift; return ref($obj); } sub sub_test { bless {}, 'Test'; } sub list { return [ shift->object_type( shift ) ]; } sub no_arguments { my $self = shift; my $new = bless {}, 'Test'; $new->{no_args} = 1 unless (@_); return $new; } sub got_no_arguments { my $self = shift; return $self->{no_args}; } package Foo; sub bar { bless {}, 'Bar'; } Petal-2.25/t/PaxHeaders.604/020_Comments.t0000644000000000000000000000007411714720667014713 xustar0030 atime=1398329059.896463569 30 ctime=1550088055.145412511 Petal-2.25/t/020_Comments.t0000644000175000001440000000064511714720667015475 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'comments.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $string = $template->process(); like ($string => qr//); unlike ($string => qr//); Petal-2.25/t/PaxHeaders.604/084_Cookbook.t0000644000000000000000000000007411714720667014706 xustar0030 atime=1398329059.964463569 30 ctime=1550088055.149412525 Petal-2.25/t/084_Cookbook.t0000644000175000001440000000462311714720667015470 0ustar00nineusers00000000000000#!/usr/bin/perl # # Tests for Petal::Cookbook recipes # # To view output, use DEBUG environment setting. # DEBUG=1 perl t/084_Cookbook.t # the output can be piped to w3m # DEBUG=1 perl t/084_Cookbook.t | w3m -T text/html # or redirected to a file for viewing with a browser # DEBUG=1 perl t/084_Cookbook.t > output.html use warnings; use strict; use lib ('lib'); use Test::More; BEGIN { eval "use CGI"; plan skip_all => "CGI required" if $@; plan 'no_plan'; } use Petal; use Data::Dumper; my $template_file = 'cookbook.html'; $Petal::BASE_DIR = './t/data/'; # Fixup path for taint support $ENV{PATH} = "/bin:/usr/bin"; # Setup Petal environment $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::INPUT = "XHTML"; $Petal::OUTPUT = "XHTML"; # Create object my $template = new Petal($template_file); # Basic - Passing a hashreference to Petal::process my $hash = { string => 'Three', 'number' => 3 }; $hash->{'foo'} = "bar"; $hash->{'arrayref'} = [ {foo => 'Craig'}, {foo => 'Jim'} ]; $hash->{'arrayref'}->[2] = {'foo' => 'William'}; # Advanced - Invoking methods on objects { package MyApplication::Record::Rater; use strict; use warnings; use CGI; use Carp; sub is_current_id { my $self = shift; return $self->{id} == 2; # Alternative way to evaluate current_id #my $cgi = CGI->new; #my $id = $cgi->param('rater.id'); #return unless (defined $id and $id and $id =~ /^\d+$/); #return $id == $self->{id}; } 1; } package main; #use MyApplication::Record::Rater; # Raters (id, first_name, last_name, relation, phone, email) my @records = ( { id => 1, first_name => 'George', last_name => 'Jetson', relation => 'father', phone => '411-232-3333', email => 'george@spacely.com', }, { id => 2, first_name => 'Judy', last_name => 'Jetson', relation => 'mother', phone => '411-232-3333', email => 'judy@spacely.com', }, { id => 3, first_name => 'Jane', last_name => 'Jetson', relation => 'daughter', phone => '411-232-3333', email => 'jane@spacely.com', }, ); bless $_, "MyApplication::Record::Rater" for (@records); $hash->{'records'} = \@records; # Advanced - Using CGI.pm to generate forms use CGI qw(-compile [:all]); $hash->{'query'} = new CGI; $hash->{'choices'} = [1, 2, 3, 4]; my $out; eval { $out = $template->process($hash); }; is($@, '', 'No errors during processing'); ok($out, 'Output was received'); print $out if $ENV{'DEBUG'}; 1; __END__ Petal-2.25/t/PaxHeaders.604/009_Style_AndAmp.t0000644000000000000000000000007411714720667015455 xustar0030 atime=1398329059.880463569 30 ctime=1550088055.149412525 Petal-2.25/t/009_Style_AndAmp.t0000644000175000001440000000050711714720667016234 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('style_andamp.html'); my $string = $template->process; unlike ($string, qr/\"\;/); 1; __END__ Petal-2.25/t/PaxHeaders.604/015_Dummy_Data.t0000644000000000000000000000007411714720667015156 xustar0030 atime=1398329059.892463569 30 ctime=1550088055.149412525 Petal-2.25/t/015_Dummy_Data.t0000644000175000001440000000050011714720667015726 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('dummy_data.xml'); my $string = ${$template->_canonicalize()}; unlike ($string, qr/\<\/a\>/); Petal-2.25/t/PaxHeaders.604/089_utf-8.t0000644000000000000000000000007411714720667014110 xustar0030 atime=1398329059.972463569 30 ctime=1550088055.149412525 Petal-2.25/t/089_utf-8.t0000644000175000001440000000077111714720667014672 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More; use Petal; plan skip_all => 'decode_charset does not work on Perl < 5.8' if $] < 5.008; plan 'no_plan'; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal (file => 'utf-8.xml', decode_charset => 'utf-8'); my $string = $template->process; my $copy = chr (169); my $acirc = chr (194); like ($string, qr/$copy/); unlike ($string, qr/$acirc/); Petal-2.25/t/PaxHeaders.604/007_String_Modifier.t0000644000000000000000000000007311714720667016216 xustar0029 atime=1398329059.87246357 30 ctime=1550088055.149412525 Petal-2.25/t/007_String_Modifier.t0000644000175000001440000000073711714720667017003 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; package Foo; sub add { return $_[1] + $_[2] }; package main; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('string.xml'); my $string = $template->process ( user => { name => 'Bruno Postle' }, number => 2, math => bless {}, 'Foo' ); like ($string, '/Hello, Bruno Postle, 2 \\+ 2 = 4/', "found"); Petal-2.25/t/PaxHeaders.604/011_Delete_Attr.t0000644000000000000000000000007411714720667015322 xustar0030 atime=1398329059.880463569 30 ctime=1550088055.149412525 Petal-2.25/t/011_Delete_Attr.t0000644000175000001440000000111211714720667016072 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('delete_attribute.xml'); my $string = $template->process; unlike ($string, qr /type/); $Petal::OUTPUT = 'HTML'; $template = new Petal ('delete_attribute.xml'); $string = $template->process; unlike ($string, qr /type/); like ($string, qr/\Qbar="0"\E/); $string = $template->process ('nothing' => ''); like ($string, qr/type/); like ($string, qr/\Qbar="0"\E/); Petal-2.25/t/PaxHeaders.604/013_Declaration.t0000644000000000000000000000007411714720667015355 xustar0030 atime=1398329059.888463569 30 ctime=1550088055.149412525 Petal-2.25/t/013_Declaration.t0000644000175000001440000000045211714720667016133 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('decl.xml'); my $string = $template->process; like ($string, qr/\<\!/); Petal-2.25/t/PaxHeaders.604/022_Hashref_List.t0000644000000000000000000000007411714720667015503 xustar0030 atime=1398329059.900463569 30 ctime=1550088055.149412525 Petal-2.25/t/022_Hashref_List.t0000644000175000001440000000075411714720667016266 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'hashref_list.html'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; $Petal::OUTPUT = "XHTML"; my $template = new Petal ($template_file); my %hash = (); $hash{'fields'} = [ { 'name' => 'field1', 'value' => 'value1' }, { 'name' => 'field2', 'value' => 'value2' }, ]; eval { $template->process(%hash) }; ok (!$@); Petal-2.25/t/PaxHeaders.604/037_Set_Nested_Var.t0000644000000000000000000000007411714720667016003 xustar0030 atime=1398329059.928463569 30 ctime=1550088055.149412525 Petal-2.25/t/037_Set_Nested_Var.t0000644000175000001440000000154111714720667016561 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; ok (1); exit; # otherwise we get an ugly file written in /tmp my $string; eval { $string = Petal->new( 'set_nested_var.html' )->process(); }; TODO: { local $TODO = 'set nested values not implemented'; if ($@) { fail( 'died after process()' ); diag($@); } else { like( $string, qr/ok: my defined/, "hash 'my' created" ); like( $string, qr/ok: my-test defined/, "hash 'my/test' created" ); like( $string, qr/ok: my-test-fu defined/, "hash 'my/test/fu' created" ); like( $string, qr/ok: foo defined/, "hash 'foo' created" ); like( $string, qr/ok: foo-1 defined/, "array 'foo/1' created" ); } } Petal-2.25/t/PaxHeaders.604/040_Tests_With_Zero.t0000644000000000000000000000007411714720667016224 xustar0030 atime=1398329059.932463569 30 ctime=1550088055.149412525 Petal-2.25/t/040_Tests_With_Zero.t0000644000175000001440000000077611714720667017013 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; { my $foo = bless { bar => 1 }, 'Foo'; my $string = Petal->new ( 'tests_with_zero.xml' )->process(); like ($string, qr/attr="0"/ => 'attributes'); unlike ($string, qr/<\/content>/ => 'content'); like ($string, qr/replace:\s+0/ => 'replace'); } Petal-2.25/t/PaxHeaders.604/043_Basic.t0000644000000000000000000000007411714720667014154 xustar0030 atime=1398329059.936463569 30 ctime=1550088055.149412525 Petal-2.25/t/043_Basic.t0000644000175000001440000000107311714720667014732 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'basic.xml'; my $template = new Petal ($template_file); my $hash = { loop => [''], }; my $string = $template->process ($hash); like ($string => qr /REPLACE/); like ($string => qr /CONTENT/); like ($string => qr /CONDITION/); like ($string => qr /LOOP/); unlike ($string => qr /OMIT-ME/); like ($string => qr //); 1; __END__ Petal-2.25/t/PaxHeaders.604/042_Path_Prefix.t0000644000000000000000000000007411714720667015343 xustar0030 atime=1398329059.936463569 30 ctime=1550088055.149412525 Petal-2.25/t/042_Path_Prefix.t0000644000175000001440000000055711714720667016127 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $string = Petal->new ( 'path_prefix.xml' )->process (foo => { baz => 'success' }, bar => 'baz'); like ($string, qr/success/); Petal-2.25/t/PaxHeaders.604/092_on-error.t0000644000000000000000000000007411714720667014702 xustar0030 atime=1398329059.976463569 30 ctime=1550088055.149412525 Petal-2.25/t/092_on-error.t0000644000175000001440000000115411714720667015460 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'eval2.xml'; my $template = new Petal ($template_file); my $string = $template->process; TODO: { local $TODO = 'http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4/#on-error'; like ($string, qr/booo<\/span>/, 'booo (XML out)'); }; unlike ($string, qr/< $file ); my $s = $t->process(); ok ($s !~ /include/); } $Petal::OUTPUT = 'XHTML'; { my $t = new Petal ( file => $file ); my $s = $t->process(); ok ($s !~ /include/); } Petal-2.25/t/PaxHeaders.604/060_Metal_Define.t0000644000000000000000000000007411714720667015446 xustar0030 atime=1398329059.948463569 30 ctime=1550088055.149412525 Petal-2.25/t/060_Metal_Define.t0000644000175000001440000000364211714720667016230 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::BASE_DIR = ('t/data'); my $file = 'metal_define_macro.xml'; $Petal::OUTPUT = 'XML'; { my $t = new Petal ( file => 'metal_define_macro.xml' ); my $s = $t->process(); like ($s, qr/Foo<\/span>/); like ($s, qr/Bar<\/span>/); like ($s, qr/Baz<\/span>/); } { my $t = new Petal ( file => 'metal_define_macro.xml#foo' ); my $s = $t->process(); like ($s, qr/Foo<\/span>/); unlike ($s, qr/Bar<\/span>/); unlike ($s, qr/Baz<\/span>/); } { my $t = new Petal ( file => 'metal_define_macro.xml#bar' ); my $s = $t->process(); unlike ($s, qr/Foo<\/span>/); like ($s, qr/Bar<\/span>/); unlike ($s, qr/Baz<\/span>/); } { my $t = new Petal ( file => 'metal_define_macro.xml#baz' ); my $s = $t->process(); unlike ($s, qr/Foo<\/span>/); unlike ($s, qr/Bar<\/span>/); like ($s, qr/Baz<\/span>/); } $Petal::OUTPUT = 'XHTML'; { my $t = new Petal ( file => 'metal_define_macro.xml' ); my $s = $t->process(); like ($s, qr/Foo<\/span>/); like ($s, qr/Bar<\/span>/); like ($s, qr/Baz<\/span>/); } { my $t = new Petal ( file => 'metal_define_macro.xml#foo' ); my $s = $t->process(); like ($s, qr/Foo<\/span>/); unlike ($s, qr/Bar<\/span>/); unlike ($s, qr/Baz<\/span>/); } { my $t = new Petal ( file => 'metal_define_macro.xml#bar' ); my $s = $t->process(); unlike ($s, qr/Foo<\/span>/); like ($s, qr/Bar<\/span>/); unlike ($s, qr/Baz<\/span>/); } { my $t = new Petal ( file => 'metal_define_macro.xml#baz' ); my $s = $t->process(); unlike ($s, qr/Foo<\/span>/); unlike ($s, qr/Bar<\/span>/); like ($s, qr/Baz<\/span>/); } Petal-2.25/t/PaxHeaders.604/096_oddeven.t0000644000000000000000000000007411714720667014567 xustar0030 atime=1398329059.980463569 30 ctime=1550088055.149412525 Petal-2.25/t/096_oddeven.t0000644000175000001440000000146611714720667015353 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'oddeven.xml'; my $template = new Petal ($template_file); my $string = $template->process (items => ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']); like ($string, '/one/'); like ($string, '/two/'); like ($string, '/three/'); like ($string, '/four/'); like ($string, '/five/'); like ($string, '/six/'); like ($string, '/seven/'); like ($string, '/eight/'); like ($string, '/nine/'); like ($string, '/ten/'); __END__ Petal-2.25/t/PaxHeaders.604/083_test_attributes_chars.t0000644000000000000000000000007411714720667017544 xustar0030 atime=1398329059.964463569 30 ctime=1550088055.149412525 Petal-2.25/t/083_test_attributes_chars.t0000644000175000001440000000071111714720667020320 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = './t/data/test_attributes_chars/'; my $template; ##### $template = new Petal('test_attributes_chars1.xml'); my $string = $template->process (value1 => 'new_value1', value2 => 'new_value2'); like ($string => qr/new_value1/); like ($string => qr/new_value2/); __END__ Petal-2.25/t/PaxHeaders.604/036_Set_Cache_Fresh.t0000644000000000000000000000007411714720667016102 xustar0030 atime=1398329059.928463569 30 ctime=1550088055.149412525 Petal-2.25/t/036_Set_Cache_Fresh.t0000644000175000001440000000054311714720667016661 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; my $template_file = 'set_cache_fresh.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; $Petal::OUTPUT = "XML"; my $template = new Petal ($template_file); like ($template->process() => qr/hello/); Petal-2.25/t/PaxHeaders.604/072_Metal_Define_Slot.t0000644000000000000000000000007411714720667016452 xustar0030 atime=1398329059.956463569 30 ctime=1550088055.149412525 Petal-2.25/t/072_Metal_Define_Slot.t0000644000175000001440000000163111714720667017230 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::HTML_ERRORS = 1; $Petal::BASE_DIR = ('t/data'); { my $file = 'metal-define-slot.html'; my $t = new Petal (file => $file); my $s = $t->process(); like ($s, qr/Test/ => 'nuthin\''); } { my $file = 'metal-define-slot.html#testmacro'; my $t = new Petal (file => $file); my $s = $t->process(); unlike ($s, qr/html/ => 'testmacro'); } { my $file = 'metal-define-slot.html#__metal_slot__boo'; my $t = new Petal (file => $file); my $s = $t->process(); like ($s, qr/Test Replace/ => 'fill-slot boo'); } { my $file = 'metal-define-slot.html#testmacro'; my $t = new Petal (file => $file); my $s = $t->process (__included_from__ => '/metal-define-slot.html'); like ($s, qr/Test Replace/ => 'fill-slot boo'); } 1; Petal-2.25/t/PaxHeaders.604/030_Attributes_AndQuot.t0000644000000000000000000000007411714720667016710 xustar0030 atime=1398329059.916463569 30 ctime=1550088055.149412525 Petal-2.25/t/030_Attributes_AndQuot.t0000644000175000001440000000255611714720667017475 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = './t/data'; my $template; my $string; ##### =cut { $Petal::OUTPUT = "XML"; $template = new Petal ('attributes_andquot.xml'); $string = ${$template->_canonicalize()}; unlike($string, '/""/'); } { $Petal::OUTPUT = "XHTML"; $template = new Petal ('attributes_andquot.xml'); $string = ${$template->_canonicalize()}; unlike($string, '/""/'); } =cut { $Petal::OUTPUT = "XML"; $template = new Petal ('inline_vars.xml'); $string = ${$template->_canonicalize()}; like($string, '/"/'); like($string, '/\<\?/'); like($string, '/\?\>/'); } exit; { $Petal::OUTPUT = "XHTML"; $template = new Petal ('inline_vars.xml'); $string = ${$template->_canonicalize()}; like($string, '/"/'); like($string, '/<\?/'); like($string, '/\?>/'); } JUMP: { $Petal::OUTPUT = "XML"; $template = new Petal ('manipulate.html'); $string = $template->process ( configuration => { get_identity_field_name => 'id' } ); like($string, '/petal:attributes="value entry\/id;"/'); like($string, '/type="hidden"/'); like($string, '/name="id"/'); } 1; __END__ Petal-2.25/t/PaxHeaders.604/019_Autoload.t0000644000000000000000000000007411714720667014706 xustar0030 atime=1398329059.896463569 30 ctime=1550088055.153412537 Petal-2.25/t/019_Autoload.t0000644000175000001440000000072211714720667015464 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More; BEGIN { eval "use CGI"; plan skip_all => "CGI required" if $@; plan 'no_plan'; } use Petal; my $template_file = 'autoload.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $res = undef; eval { $res = $template->process ( cgi => new CGI ) }; ok (!$@); like ($res => qr/input/); Petal-2.25/t/PaxHeaders.604/003_More_Include.t0000644000000000000000000000007311714720667015473 xustar0029 atime=1398329059.86846357 30 ctime=1550088055.153412537 Petal-2.25/t/003_More_Include.t0000644000175000001440000000070611714720667016254 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/multiple_includes'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'register_form.tmpl'; my $template = new Petal ($template_file); my $data_ref = $template->_file_data_ref; $data_ref = $template->_canonicalize; my @count = $$data_ref =~ /(include)/gsm; ok (scalar @count > 1); 1; Petal-2.25/t/PaxHeaders.604/081_Petal_I18NProcessor.t0000644000000000000000000000007411714720667016641 xustar0030 atime=1398329059.960463569 30 ctime=1550088055.153412537 Petal-2.25/t/081_Petal_I18NProcessor.t0000644000175000001440000000146311714720667017422 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal::I18N; use Petal; eval "use Lingua::31337"; if ($@) { warn "Lingua::31337 not found - skipping"; ok (1); } else { eval "use Petal::TranslationService::h4x0r"; die $@ if ($@); $Petal::TranslationService = Petal::TranslationService::h4x0r->new(); my $xml = <
    Konichiwa, Buruno-san, Kyoo wa o-genki desu ka?
    EOF $xml =~ s/\s*$//; my $res = Petal::I18N->process ($xml); ok ($res =~ /Buruno/); ok ($res !~ /Konichiwa/); } 1; __END__ Petal-2.25/t/PaxHeaders.604/071_Encode_Overloaded_Object.t0000644000000000000000000000007411714720667017763 xustar0030 atime=1398329059.956463569 30 ctime=1550088055.153412537 Petal-2.25/t/071_Encode_Overloaded_Object.t0000644000175000001440000000100111714720667020530 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More; use warnings; use lib 'lib'; use Petal; eval { require URI; }; if( $@ ) { plan skip_all => 'URI.pm not installed'; } else { plan tests => 1; } $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::HTML_ERRORS = 1; $Petal::BASE_DIR = ('t/data'); my $file = 'content_encoded.html'; { my $t = new Petal ( file => $file ); my $s = $t->process ( test => URI->new ('http://example.com/test.cgi?foo=test&bar=test') ); like ($s, qr/\&\;/); } Petal-2.25/t/PaxHeaders.604/062_Metal_Self_Include.t0000644000000000000000000000007411714720667016612 xustar0030 atime=1398329059.948463569 30 ctime=1550088055.153412537 Petal-2.25/t/062_Metal_Self_Include.t0000644000175000001440000000067611714720667017400 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::BASE_DIR = ('t/data'); my $file = 'metal_self_include.xml'; { my $t = new Petal ( file => $file ); my $s = $t->process(); unlike ($s, qr/glop/); } $Petal::OUTPUT = 'XHTML'; { my $t = new Petal ( file => $file ); my $s = $t->process(); unlike ($s, qr/glop/); } Petal-2.25/t/PaxHeaders.604/010_XHTML.t0000644000000000000000000000007411714720667014021 xustar0030 atime=1398329059.880463569 30 ctime=1550088055.153412537 Petal-2.25/t/010_XHTML.t0000644000175000001440000000065111714720667014600 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::OUTPUT = 'XHTML'; my $template = new Petal ('xhtml.html'); my $string = $template->process; unlike ($string, qr/<\/link>/); unlike ($string, qr/<\/br>/); unlike ($string, qr/<\/hr>/); unlike ($string, qr/<\/input>/); Petal-2.25/t/PaxHeaders.604/093_translate.t0000644000000000000000000000007411714720667015135 xustar0030 atime=1398329059.976463569 30 ctime=1550088055.153412537 Petal-2.25/t/093_translate.t0000644000175000001440000000064611714720667015720 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal (file => 'translate.xml'); my $string = $template->process; my $res = Petal::I18N->process ($string); unlike ($res, '/\$\{1\}/'); unlike ($res, '/\$\{2\}/'); like ($res, '/download\.gna\.org/'); Petal-2.25/t/PaxHeaders.604/035_Petal_Language.t0000644000000000000000000000007411714720667016004 xustar0030 atime=1398329059.924463569 30 ctime=1550088055.153412537 Petal-2.25/t/035_Petal_Language.t0000644000175000001440000000214111714720667016557 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; # exists_filename tests { my $filename; $filename = Petal::Functions::exists_filename ('fr-CA' => './t/data/language/exists_filename/'); is ($filename => 'fr-CA.html'); $filename = Petal::Functions::exists_filename ('fr' => './t/data/language/exists_filename/'); is ($filename => 'fr.xml'); $filename = Petal::Functions::exists_filename ('en' => './t/data/language/exists_filename/'); ok (not defined $filename); } # parent_language { my $lang = 'fr-CA'; $lang = Petal::Functions::parent_language ($lang); is ($lang => 'fr'); $lang = Petal::Functions::parent_language ($lang); is ($lang => 'en'); $lang = Petal::Functions::parent_language ($lang); ok (not defined $lang); } { local $Petal::OUTPUT = 'XML'; local $Petal::BASE_DIR = 't/data/language'; my $template = new Petal ( file => '.', lang => 'fr-CA'); like ($template->process() => qr/fr\-CA/); } __END__ Petal-2.25/t/PaxHeaders.604/082_Petal_Gettext.t0000644000000000000000000000007411714720667015707 xustar0030 atime=1398329059.964463569 30 ctime=1550088055.153412537 Petal-2.25/t/082_Petal_Gettext.t0000644000175000001440000000471111714720667016467 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal::I18N; use Petal; eval "use Locale::Maketext::Gettext"; if ($@) { warn "Locale::Maketext::Gettext not found - skipping"; ok (1); } else { eval "use Petal::TranslationService::MOFile"; eval "use Petal::TranslationService::Gettext"; $@ and die $@; my %lexicon = read_mo ('./t/data/gettext/mo/fr.mo'); ok ( $lexicon{'you-are-user'} ); ok ( $lexicon{'hello-this-is-a-test'} ); my $ts = Petal::TranslationService::MOFile->new ('./t/data/gettext/mo/en.mo'); my $t = new Petal ( file => './t/data/gettext/html/index.html', disk_cache => 0, memory_cache => 0, translation_service => $ts ); my $res = $t->process( user_name => 'becky'); like ($res, qr/Hello, this is a test/); like ($res, qr/You are user \becky\<\/span\>/); like ($res, qr/a search engine/); $ts = Petal::TranslationService::MOFile->new ('./t/data/gettext/mo/fr.mo'); ok ($ts->maketext ('you-are-user')); ok ($ts->maketext ('hello-this-is-a-test')); $t = new Petal ( file => './t/data/gettext/html/index.html', disk_cache => 0, memory_cache => 0, translation_service => $ts ); $res = $t->process ( user_name => 'becky'); like ($res, qr/Bonjour, ceci est un test/); my $ts_en = Petal::TranslationService::Gettext->new ( locale_dir => './t/data/locale', target_lang => 'en', ); my $ts_es = Petal::TranslationService::Gettext->new ( locale_dir => './t/data/locale', target_lang => 'es', ); my $ts_fr = Petal::TranslationService::Gettext->new ( locale_dir => './t/data/locale', target_lang => 'fr', ); $t = new Petal ( file => './t/data/i18n-test.html', disk_cache => 0, memory_cache => 0 ); $res = $t->process(); like ($res, qr/i18n/); like ($res, qr/Hello, World/); $t->{translation_service} = $ts_en; $res = $t->process(); unlike ($res, qr/i18n/); like ($res, qr/Hello, World/); $t->{translation_service} = $ts_fr; $res = $t->process(); unlike ($res, qr/i18n/); like ($res, qr/Bonjour, le monde/); $t->{translation_service} = $ts_es; $res = $t->process(); unlike ($res, qr/i18n/); like ($res, qr/Hola, Mundo/); } 1; __END__ Petal-2.25/t/PaxHeaders.604/091_attribute-newline.t0000644000000000000000000000007411714720667016600 xustar0030 atime=1398329059.976463569 30 ctime=1550088055.153412537 Petal-2.25/t/091_attribute-newline.t0000644000175000001440000000074311714720667017361 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $string = Petal->new ('attribute-newline.xml')->process (); like ($string, '/>appleorangeplumpearay bee ceeex why zedprocess(); unlike($string, '/\\\\;/'); } { $Petal::OUTPUT = "XHTML"; $template = new Petal ('test_attributes2.xml'); $string = $template->process(); unlike($string, '/\\\\;/'); } __END__ Petal-2.25/t/PaxHeaders.604/070_HTML_Errors.t0000644000000000000000000000007411714720667015233 xustar0030 atime=1398329059.956463569 30 ctime=1550088055.153412537 Petal-2.25/t/070_HTML_Errors.t0000644000175000001440000000077611714720667016022 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::HTML_ERRORS = 1; $Petal::BASE_DIR = ('t/data/html_errors'); my $file = 'not_xml.html'; { my $t = new Petal ( file => $file ); my $s = $t->process(); like ($s, qr/\/); like ($s, qr/\<\/pre\>/); } $file = 'no_var.html'; { my $t = new Petal ( file => $file ); my $s = $t->process(); like ($s, qr/Cannot fetch/); } Petal-2.25/t/PaxHeaders.604/024_Namespaces.t0000644000000000000000000000007411714720667015211 xustar0030 atime=1398329059.904463569 30 ctime=1550088055.153412537 Petal-2.25/t/024_Namespaces.t0000644000175000001440000000250411714720667015767 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'namespaces.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; my $template = new Petal ($template_file); my $string; $string = $template->process ( replace => 'REPLACE', content => 'CONTENT', attribute => 'ATTRIBUTE', elements => [ 'ELEMENT1', 'ELEMENT2', 'ELEMENT3' ], ); like ($string => qr/REPLACE/); like ($string => qr/\Q

    CONTENT<\/p>\E/); like ($string => qr/\Q

    yo<\/p>\E/); like ($string => qr/\Q

  • ELEMENT1<\/li>\E/); like ($string => qr/\Q
  • ELEMENT2<\/li>\E/); like ($string => qr/\Q
  • ELEMENT3<\/li>\E/); unlike ($string => qr/\Qtal:\E/); unlike ($string => qr/\Qxmlns:\E/); $Petal::OUTPUT = "XHTML"; $string = $template->process ( replace => 'REPLACE', content => 'CONTENT', attribute => 'ATTRIBUTE', elements => [ 'ELEMENT1', 'ELEMENT2', 'ELEMENT3' ], ); like ($string => qr/REPLACE/); like ($string => qr/\Q

    CONTENT<\/p>\E/); like ($string => qr/\Q

    yo<\/p>\E/); like ($string => qr/\Q

  • ELEMENT1<\/li>\E/); like ($string => qr/\Q
  • ELEMENT2<\/li>\E/); like ($string => qr/\Q
  • ELEMENT3<\/li>\E/); unlike ($string => qr/\Qtal:\E/); unlike ($string => qr/\Qxmlns:\E/); Petal-2.25/t/PaxHeaders.604/090_dollarone-again.t0000644000000000000000000000007411714720667016171 xustar0030 atime=1398329059.972463569 30 ctime=1550088055.153412537 Petal-2.25/t/090_dollarone-again.t0000644000175000001440000000104711714720667016750 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; #use Petal::TranslationService::h4x0r; #$Petal::TranslationService = Petal::TranslationService::h4x0r->new(); my $template = new Petal (file => 'dollarone-again.xml'); my $string = $template->process; my $res = Petal::I18N->process ($string); TODO: { local $TODO = 'shouldn\'t output internal ${1} representation'; unlike ($res, '/\$\{1\}/'); }; Petal-2.25/t/PaxHeaders.604/088_latin1.t0000644000000000000000000000007411714720667014334 xustar0030 atime=1398329059.972463569 30 ctime=1550088055.153412537 Petal-2.25/t/088_latin1.t0000644000175000001440000000077411714720667015121 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More; use Petal; plan skip_all => 'decode_charset does not work on Perl < 5.8' if $] < 5.008; plan 'no_plan'; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal (file => 'latin1.xml', decode_charset => 'latin1'); my $string = $template->process; my $copy = chr (169); my $acirc = chr (194); like ($string, qr/$copy/); unlike ($string, qr/$acirc/); Petal-2.25/t/PaxHeaders.604/032_Hypen_XML.t0000644000000000000000000000007411714720667014734 xustar0030 atime=1398329059.916463569 30 ctime=1550088055.153412537 Petal-2.25/t/032_Hypen_XML.t0000644000175000001440000000066411714720667015517 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = './t/data'; my $template; my $string; ##### { $Petal::OUTPUT = "XHTML"; $template = new Petal ('hypen.xml'); $string = $template->process(); like ($string => qr/ qr/<\/foo-bar/); } __END__ Petal-2.25/t/PaxHeaders.604/053_Opt_taint.t0000644000000000000000000000007411714720667015075 xustar0030 atime=1398329059.944463569 30 ctime=1550088055.153412537 Petal-2.25/t/053_Opt_taint.t0000644000175000001440000000167311714720667015661 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'taint' option to Petal->new. # use Test::More tests => 4; use warnings; use lib 'lib'; use Petal; use File::Spec; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'if.html'; # Confirm taint mode defaults to off my $template = new Petal (file => $file, base_dir => $data_dir); ok(!$template->taint, "taint mode defaults to off"); # Confirm option can enable it $template = new Petal (file => $file, base_dir => $data_dir, taint => 1); ok($template->taint, "taint option turns it on"); # Confirm global can enable it $Petal::TAINT = 1; $template = new Petal (file => $file, base_dir => $data_dir); ok($template->taint, "\$Petal::TAINT turns it on"); # Confirm option can disable it $template = new Petal (file => $file, base_dir => $data_dir, taint => 0); ok(!$template->taint, "taint option turns it off again"); Petal-2.25/t/PaxHeaders.604/085_lang_include_memcache.t0000644000000000000000000000007411714720667017407 xustar0030 atime=1398329059.968463569 30 ctime=1550088055.153412537 Petal-2.25/t/085_lang_include_memcache.t0000644000175000001440000000272311714720667020170 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'language' option (and 'lang' alias) to Petal->new. # Uses t/data/language/* # # this is identical to t/052_Opt_language but with MEMORY_CACHE=1 use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; use File::Spec; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 1; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'language'; my @args = ( replace => 'Replacement Text', content => 'Content Here', attribute => 'An attribute', elements => [ 'one', 'two' ], ); # Try processing a template with a language and an include my $template = new Petal (file => $file, base_dir => $data_dir, language => 'fr'); is($template->language, 'fr', 'correct language requested (fr)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "template with language and includes successfully processed"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr\)\s+

    }x, "output is correct"); # Same again but using 'lang' option alias $template = new Petal (file => $file, base_dir => $data_dir, lang => 'fr-CA'); is($template->language, 'fr-CA', 'correct language requested (fr-CA)'); $@ = ''; $output = eval { $template->process(@args) }; ok(!$@, "template with lang and includes successfully processed"); like($output, qr{^\s*

    \s+ Bonjour,\sMonde\s\(fr-CA\)\s+

    }x, "output is correct"); Petal-2.25/t/PaxHeaders.604/benchmark.pl0000644000000000000000000000007411714720667014647 xustar0030 atime=1398329059.984463569 30 ctime=1550088055.153412537 Petal-2.25/t/benchmark.pl0000644000175000001440000000132411714720667015424 0ustar00nineusers00000000000000#!/usr/bin/perl ## ## Benchmark some common functions ## use warnings; use lib 'lib'; use Test::More qw( no_plan ); use Benchmark; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 1; $Petal::TAINT = 1; $Petal::INPUT = 'HTML'; #$Petal::Hash::Var::ERROR_ON_UNDEF_VAR = 0; my %vars = ( foo => bless ({ bar => 1 }, 'Foo'), list => [ 1, 2, 3, 4 ], session => { id => '1234asdf', user => { id => 'fred', name => 'fred fish' }, }, ); diag ("running benchmarks for 10s..."); my $b = timethis (-10, sub { run_test( %vars ) }); diag (timestr $b); ok (1); sub run_test { Petal->new( 'benchmark.html' )->process( @_ ); } Petal-2.25/t/PaxHeaders.604/023_Loop_Error.t0000644000000000000000000000007411714720667015213 xustar0030 atime=1398329059.900463569 30 ctime=1550088055.153412537 Petal-2.25/t/023_Loop_Error.t0000644000175000001440000000203111714720667015764 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; my $template_file = 'loop_error.xml'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = 't/data'; $Petal::OUTPUT = "XHTML"; my $template = new Petal ($template_file); my %hash = ( 'array_of_nums' => [1,2,3,], 'array_of_chars' => [qw/ a b c /], 'array_of_stuff' => ['!', '@', '#'], 'array_of_nums2' => [9,8,7,], 'array_of_chars2' => [qw/ x y z /], 'array_of_stuff2' => [qw/ $ % ^ /], 'array_of_nums3' => [4,5,6,], 'array_of_chars3' => [qw/ g h i /], 'array_of_stuff3' => [qw/ & * | /], ); my $str = undef; eval { $str = $template->process(%hash) }; # shouldn't be any "num=[...]" that don't have numbers inside unlike ($str, qr/num=\[\D+\]/); # shouldn't be any "chr=[...]" that don't have chars inside unlike ($str, qr/chr=\[\W+\]/); # shouldn't be any "stf=[...]" that don't have 'stuff' inside unlike ($str, qr/stf=\[[^\W]+\]/); Petal-2.25/t/PaxHeaders.604/073_Metal_Fill_Slot.t0000644000000000000000000000007411714720667016147 xustar0030 atime=1398329059.960463569 30 ctime=1550088055.153412537 Petal-2.25/t/073_Metal_Fill_Slot.t0000644000175000001440000000062411714720667016726 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::HTML_ERRORS = 1; $Petal::BASE_DIR = ('t/data'); { my $file = 'metal-fill-slot.html'; my $t = new Petal (file => $file); my $s = $t->process ( bar => 'myvar' ); like ($s, qr/This is kind of a simple test/); like ($s, qr/myvar/); } 1; Petal-2.25/t/PaxHeaders.604/039_Access_Objects.t0000644000000000000000000000007411714720667016012 xustar0030 atime=1398329059.932463569 30 ctime=1550088055.157412549 Petal-2.25/t/039_Access_Objects.t0000644000175000001440000000112411714720667016565 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; { my $foo = bless { bar => 1 }, 'Foo'; my $string = Petal->new( 'access_obj_hash.html' )->process ( foo => $foo ); like( $string, qr/ok: bar/, 'accessed [bar] var in [foo]' ); } { my $foo = bless [ bar => 1 ], 'Foo'; my $string = Petal->new( 'access_obj_array.html' )->process( foo => $foo ); like( $string, qr/ok: index 0/, 'accessed index 0 of [foo]' ); } Petal-2.25/t/PaxHeaders.604/098_multiple-attributes.t0000644000000000000000000000007411714720667017164 xustar0030 atime=1398329059.984463569 30 ctime=1550088055.157412549 Petal-2.25/t/098_multiple-attributes.t0000644000175000001440000000141211714720667017737 0ustar00nineusers00000000000000#!/usr/bin/perl package thing; sub new { my $class = shift; $class = ref $class || $class; my $self = bless {}, $class; return $self; } sub method { my $self = shift; join ':', @_; } package main; use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'multiple-attributes.xml'; my $template = new Petal ($template_file); sub joinme {join ':', @_} my $object = new thing; my %hash = ( foo => 'bar' ); my $string = $template->process (object => $object, coderef => \&joinme, hash => \%hash); like ($string, '/harpo:chico/'); like ($string, '/groucho:zeppo/'); __END__ Petal-2.25/t/PaxHeaders.604/080_Petal_TranslationService_h4x0r.t0000644000000000000000000000007411714720667021125 xustar0030 atime=1398329059.960463569 30 ctime=1550088055.157412549 Petal-2.25/t/080_Petal_TranslationService_h4x0r.t0000644000175000001440000000075211714720667021706 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; eval "use Lingua::31337"; if ($@) { warn "Lingua::31337 not found - skipping"; ok (1); } else { eval "use Petal::TranslationService::h4x0r"; die $@ if ($@); my $trans = new Petal::TranslationService::h4x0r; ok ($trans->isa ('Petal::TranslationService::h4x0r')); my $string = 'Adam, Bruno, Chris'; my $res = $trans->maketext ($string); ok ($res ne $string); } 1; __END__ Petal-2.25/t/PaxHeaders.604/034_Plugin.t0000644000000000000000000000007411714720667014371 xustar0030 atime=1398329059.924463569 30 ctime=1550088055.157412549 Petal-2.25/t/034_Plugin.t0000644000175000001440000000054111714720667015146 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $|=1; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = './t/data'; $Petal::OUTPUT = "XML"; my $template = new Petal ('plugin.xml'); my $str = $template->process(); like($str, '/HELLO, WORLD/', "matches"); __END__ Petal-2.25/t/PaxHeaders.604/044_Comment_With_PI.t0000644000000000000000000000007411714720667016121 xustar0030 atime=1398329059.936463569 30 ctime=1550088055.157412549 Petal-2.25/t/044_Comment_With_PI.t0000644000175000001440000000073711714720667016705 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template_file = 'comment_does_not_die.xml'; my $template = new Petal ($template_file); my $res; eval { $res = $template->process( bar => 'BAZ' ) }; ok (!$@ => 'process() does not die'); like ($res, qr// => 'comment is the same'); 1; __END__ Petal-2.25/t/PaxHeaders.604/051_Opt_in_out.t0000644000000000000000000000007411714720667015251 xustar0030 atime=1398329059.940463569 30 ctime=1550088055.157412549 Petal-2.25/t/051_Opt_in_out.t0000644000175000001440000000232711714720667016032 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'input' and 'output' options to Petal->new and related # functionality. Uses t/data/if.html and t/data/if.xml for templates. # 'if.html' is assumed to not be well formed. # use Test::More tests => 3; use warnings; use lib 'lib'; use Petal; use File::Spec; $Petal::DISK_CACHE = 0; my $data_dir = File::Spec->catdir('t', 'data'); my $file = 'if.html'; my @args = ( error => 'Altitude too low!', ); # Confirm input format defaults to XML my $template = new Petal (file => $file, base_dir => $data_dir); # is($template->input, 'XML', "input format defaults to 'XML'"); $@ = ''; my $output = eval { $template->process(@args); }; # ok($@, "Template processing fails (as expected)"); # Confirm that it works with something that's good enough $template = new Petal (file => 'if.xml', base_dir => $data_dir, input => 'HTML'); is ($template->input, 'HTML', "input option overrides default"); $@ = ''; $output = eval { $template->process(@args); }; ok (!$@, "Template processed successfully"); like ($output, qr{^\s*
    \s* Altitude\stoo\slow!

    \s*
    }x, "Output is correct"); Petal-2.25/t/PaxHeaders.604/033_Hash.t0000644000000000000000000000007411714720667014015 xustar0030 atime=1398329059.924463569 30 ctime=1550088055.157412549 Petal-2.25/t/033_Hash.t0000644000175000001440000000152011714720667014570 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; package SomeObject; sub list { [ 1, 2, 3, 4 ] } sub as_string { 'Haro Genki' } package main; use strict; use warnings; use lib ('lib'); use Petal; $|=1; $Petal::DEBUG_DUMP = 0; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::OUTPUT = "XML"; my $template = new Petal ('hash_mustpass.xml'); my $object = bless {}, 'SomeObject'; my $string; eval { $string = $template->process (object => $object); }; ok(! $@, 'process hash_mustpass.xml' ); diag ($@) if ($@); $template = new Petal ('hash_mustfail.xml'); $string = undef; eval { $string = $template->process (object => $object); }; ok( $@, 'process hash_mustfail.xml' ); diag ($string) if ($string); __END__ Petal-2.25/t/PaxHeaders.604/065_HTML_Attribute_Strip.t0000644000000000000000000000007411714720667017107 xustar0030 atime=1398329059.952463569 30 ctime=1550088055.157412549 Petal-2.25/t/065_HTML_Attribute_Strip.t0000644000175000001440000000067111714720667017670 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::BASE_DIR = ('t/data'); my $file = 'attribute_strip.html'; { my $t = new Petal ( file => $file ); my $s = $t->process(); like ($s, qr/test/); } $Petal::OUTPUT = 'XHTML'; { my $t = new Petal ( file => $file ); my $s = $t->process(); like ($s, qr/test/); } Petal-2.25/t/PaxHeaders.604/061_Metal_Use.t0000644000000000000000000000007411714720667015011 xustar0030 atime=1398329059.948463569 30 ctime=1550088055.157412549 Petal-2.25/t/061_Metal_Use.t0000644000175000001440000000125511714720667015571 0ustar00nineusers00000000000000#!/usr/bin/perl use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::BASE_DIR = ('t/data'); my $file = 'metal_use_macro.xml'; $Petal::OUTPUT = 'XML'; { my $t = new Petal ( file => 'metal_use_macro.xml' ); my $s = $t->process(); like ($s, qr/This is some stuff which should appear/); like ($s, qr/Foo<\/span>/); unlike ($s, qr/DOCTYPE/); } $Petal::OUTPUT = 'XHTML'; { my $t = new Petal ( file => 'metal_use_macro.xml' ); my $s = $t->process(); like ($s, qr/This is some stuff which should appear/); like ($s, qr/Foo<\/span>/); unlike ($s, qr/DOCTYPE/); } Petal-2.25/t/PaxHeaders.604/063_Nbsp.t0000644000000000000000000000007411714720667014037 xustar0030 atime=1398329059.952463569 30 ctime=1550088055.157412549 Petal-2.25/t/063_Nbsp.t0000644000175000001440000000063211714720667014615 0ustar00nineusers00000000000000#!/usr/bin/perl use warnings; use strict; use lib ('lib'); use Test::More 'no_plan'; use Petal; $Petal::INPUT = 'HTML'; $Petal::BASE_DIR = './t/data/'; $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; my $template = new Petal ('nbsp.html'); my $string = $template->process; my $nbsp = chr (160); my $acirc = chr (194); like ($string, qr/$nbsp/); unlike ($string, qr/$acirc/); Petal-2.25/t/PaxHeaders.604/097_cache_only.t0000644000000000000000000000007411714720667015250 xustar0030 atime=1398329059.980463569 30 ctime=1550088055.157412549 Petal-2.25/t/097_cache_only.t0000644000175000001440000000205611714720667016030 0ustar00nineusers00000000000000#!/usr/bin/perl ############################################################################## # Tests the 'language' option (and 'lang' alias) to Petal->new. # Uses t/data/language/* # # this is identical to t/052_Opt_language but with DISK_CACHE=1 use Test::More 'no_plan'; use warnings; use lib 'lib'; use Petal; $Petal::MEMORY_CACHE = 1; $Petal::DISK_CACHE = 0; $Petal::CACHE_ONLY = 1; my $data_dir = 't/data'; my $file = 'cookbook.html'; my $template = new Petal (file => $file, base_dir => $data_dir); ok (eval {$template->process()}, 'process() CACHE_ONLY=1 without args should succeed'); $Petal::CACHE_ONLY = 0; $Petal::MEMORY_CACHE = 0; $file = 'children.xml'; my $template_A = new Petal (file => $file, base_dir => $data_dir); ok (!eval {$template_A->process()}, 'process() without args should fail'); $Petal::MEMORY_CACHE = 1; $file = 'children.xml'; my $template_B = new Petal (file => $file, base_dir => $data_dir, cache_only => 1); ok (eval {$template_B->process()}, 'process() cache_only=1 without args should succeed'); Petal-2.25/PaxHeaders.604/lib0000644000000000000000000000013213431073567012577 xustar0030 mtime=1550088055.145412511 30 atime=1550088055.137412486 30 ctime=1550088055.145412511 Petal-2.25/lib/0000755000175000001440000000000013431073567013436 5ustar00nineusers00000000000000Petal-2.25/lib/PaxHeaders.604/Petal0000644000000000000000000000013213431073567013644 xustar0030 mtime=1550088055.157412549 30 atime=1550088055.137412486 30 ctime=1550088055.157412549 Petal-2.25/lib/Petal/0000755000175000001440000000000013431073567014503 5ustar00nineusers00000000000000Petal-2.25/lib/Petal/PaxHeaders.604/Parser.pm0000644000000000000000000000007311714720667015521 xustar0029 atime=1398329059.83646357 30 ctime=1550088055.137412486 Petal-2.25/lib/Petal/Parser.pm0000644000175000001440000001310711714720667016301 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Parser - Fires Petal::Canonicalizer events # ------------------------------------------------------------------ # A Wrapper class for MKDoc::XML:TreeBuilder which is meant to be # used for Petal::Canonicalizer. # ------------------------------------------------------------------ package Petal::Parser; use MKDoc::XML::TreeBuilder; use MKDoc::XML::Decode; use strict; use warnings; use Carp; use Petal::Canonicalizer::XML; use Petal::Canonicalizer::XHTML; use vars qw /@NodeStack @MarkedData $Canonicalizer @NameSpaces @XI_NameSpaces @MT_NameSpaces @MT_Name_Cur $Decode/; # this avoid silly warnings sub sillyness { $Petal::NS, $Petal::NS_URI, $Petal::XI_NS_URI; } sub new { my $class = shift; $class = ref $class || $class; return bless { @_ }, $class; } sub process { my $self = shift; local $Canonicalizer = shift; my $data_ref = shift; local @MarkedData = (); local @NodeStack = (); local @NameSpaces = (); local @MT_NameSpaces = (); local @MT_Name_Cur = ('main'); local $Decode = new MKDoc::XML::Decode (qw /xml numeric/); $data_ref = (ref $data_ref) ? $data_ref : \$data_ref; my @top_nodes = MKDoc::XML::TreeBuilder->process_data ($$data_ref); for (@top_nodes) { $self->generate_events ($_) } @MarkedData = (); @NodeStack = (); } # generate_events(); # ------------------ # Once the HTML::TreeBuilder object is built and elementified, it is # passed to that subroutine which will traverse it and will trigger # proper subroutines which will generate the XML events which are used # by the Petal::Canonicalizer module sub generate_events { my $self = shift; my $tree = shift; if (ref $tree) { my $tag = $tree->{_tag}; my $attr = { map { /^_/ ? () : ( $_ => $Decode->process ($tree->{$_}) ) } keys %{$tree} }; if ($tag eq '~comment') { generate_events_comment ($tree->{text}); } else { # decode attributes for (keys %{$tree}) { $tree->{$_} = $Decode->process ( $tree->{$_} ) unless (/^_/); } push @NodeStack, $tree; generate_events_start ($tag, $attr); foreach my $content (@{$tree->{_content}}) { $self->generate_events ($content); } generate_events_end ($tag); pop (@NodeStack); } } else { $tree = $Decode->process ( $tree ); generate_events_text ($tree); } } sub generate_events_start { local $_ = shift; $_ = "<$_>"; local %_ = %{shift()}; delete $_{'/'}; # process the Petal namespace my $ns = (scalar @NameSpaces) ? $NameSpaces[$#NameSpaces] : $Petal::NS; foreach my $key (keys %_) { my $value = $_{$key}; if ($value eq $Petal::NS_URI) { next unless ($key =~ /^xmlns\:/); delete $_{$key}; $ns = $key; $ns =~ s/^xmlns\://; } } push @NameSpaces, $ns; local ($Petal::NS) = $ns; # process the XInclude namespace my $xi_ns = (scalar @XI_NameSpaces) ? $XI_NameSpaces[$#XI_NameSpaces] : $Petal::XI_NS; foreach my $key (keys %_) { my $value = $_{$key}; if ($value eq $Petal::XI_NS_URI) { next unless ($key =~ /^xmlns\:/); delete $_{$key}; $xi_ns = $key; $xi_ns =~ s/^xmlns\://; } } push @XI_NameSpaces, $xi_ns; local ($Petal::XI_NS) = $xi_ns; # process the Metal namespace my $mt_ns = (scalar @MT_NameSpaces) ? $MT_NameSpaces[$#MT_NameSpaces] : $Petal::MT_NS; foreach my $key (keys %_) { my $value = $_{$key}; if ($value eq $Petal::MT_NS_URI) { next unless ($key =~ /^xmlns\:/); delete $_{$key}; $mt_ns = $key; $mt_ns =~ s/^xmlns\://; } } push @MT_NameSpaces, $mt_ns; local ($Petal::MT_NS) = $mt_ns; # process the Metal current name my $pushed = 0; $_{"$mt_ns:define-macro"} and do { $pushed = 1; delete $_{"$mt_ns:define-slot"}; push @MT_Name_Cur, delete $_{"$mt_ns:define-macro"}; }; $_{"$mt_ns:fill-slot"} and do { $pushed = 1; push @MT_Name_Cur, "__metal_slot__" . delete $_{"$mt_ns:fill-slot"}; }; push @MT_Name_Cur, $MT_Name_Cur[$#MT_Name_Cur] unless ($pushed); my $dont_skip = grep /^\Q$Petal::MT_NAME_CUR\E$/, @MT_Name_Cur; $Canonicalizer->StartTag() if ($dont_skip); } sub generate_events_end { local $_ = shift; local $_ = ""; local ($Petal::NS) = pop (@NameSpaces); local ($Petal::XI_NS) = pop (@XI_NameSpaces); local ($Petal::MT_NS) = pop (@MT_NameSpaces); my $skip = 1; for (@MT_Name_Cur) { $_ eq $Petal::MT_NAME_CUR and $skip = 0 } my $dont_skip = grep /^\Q$Petal::MT_NAME_CUR\E$/, @MT_Name_Cur; $Canonicalizer->EndTag() if ($dont_skip); pop (@MT_Name_Cur); } sub generate_events_text { my $skip = 1; for (@MT_Name_Cur) { $_ eq $Petal::MT_NAME_CUR and $skip = 0 } my $data = shift; $data =~ s/\&/&/g; $data =~ s/\Text() if ($dont_skip); } sub generate_events_comment { my $skip = 1; for (@MT_Name_Cur) { $_ eq $Petal::MT_NAME_CUR and $skip = 0 } my $data = shift; local $_ = ''; my $dont_skip = grep /^\Q$Petal::MT_NAME_CUR\E$/, @MT_Name_Cur; $Canonicalizer->Text() if ($dont_skip); } 1; __END__ Petal-2.25/lib/Petal/PaxHeaders.604/TranslationService0000644000000000000000000000013213431073567017463 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.141412499 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/TranslationService/0000755000175000001440000000000013431073567020322 5ustar00nineusers00000000000000Petal-2.25/lib/Petal/TranslationService/PaxHeaders.604/h4x0r.pm0000644000000000000000000000007311714720667021051 xustar0029 atime=1398329059.86046357 30 ctime=1550088055.141412499 Petal-2.25/lib/Petal/TranslationService/h4x0r.pm0000644000175000001440000000072211714720667021630 0ustar00nineusers00000000000000package Petal::TranslationService::h4x0r; use Petal::Hash::String; use Lingua::31337; use warnings; use strict; sub new { my $class = shift; return bless { @_ }, $class; } sub maketext { my $self = shift; my $string = shift; my @tokens = @{Petal::Hash::String->_tokenize (\$string)}; my @res = map { ($_ =~ /$Petal::Hash::String::TOKEN_RE/gsm) ? $_ : Lingua::31337::text231337 ($_) } @tokens; return join '', @res; } 1; __END__ Petal-2.25/lib/Petal/TranslationService/PaxHeaders.604/Gettext.pm0000644000000000000000000000007311714720667021530 xustar0029 atime=1398329059.85646357 30 ctime=1550088055.141412499 Petal-2.25/lib/Petal/TranslationService/Gettext.pm0000644000175000001440000000364611714720667022317 0ustar00nineusers00000000000000package Petal::TranslationService::Gettext; use Petal::TranslationService::MOFile; use warnings; use strict; sub new { my $class = shift; return bless { # defaults... locale_dir => '/usr/share/locale', target_lang => 'en', # optional overriding args @_, }, $class; } sub maketext { my $self = shift; my $tsrv = $self->mo_file_translation_service(); ref $tsrv and return $tsrv->maketext (@_); return; } sub target_lang { my $self = shift; $self->{target_lang} =~ s/-/_/; return $self->{target_lang}; } sub mo_file_translation_service { my $self = shift; my $domain = $Petal::I18N::Domain || 'default'; $self->{mo_file_tranlation_services} ||= {}; $self->{mo_file_tranlation_services}->{$domain} ||= $self->_mo_file_translation_service(); return $self->{mo_file_tranlation_services}->{$domain}; } sub _mo_file_translation_service { my $self = shift; my $target_lang = $self->target_lang() || die 'target_lang() returned undef'; my $domain = $Petal::I18N::Domain || 'default'; my $res = undef; $res = $self->_instanciate_mo_file_tranlation_service_if_file_exists ($target_lang); $res && return $res; $target_lang =~ s/_.*$//; $res = $self->_instanciate_mo_file_tranlation_service_if_file_exists ($target_lang); $res && return $res; return '__none__'; } sub _instanciate_mo_file_tranlation_service_if_file_exists { my $self = shift; my $target_lang = $self->{target_lang}; my $domain = $Petal::I18N::Domain || 'default'; my $locale_dir = $self->{locale_dir}; $locale_dir =~ s/\/$//; my $mo_file_relative_path = "/$target_lang/LC_MESSAGES/$domain.mo"; my $mo_file_absolute_path = $locale_dir . $mo_file_relative_path; -e $mo_file_absolute_path or return; return Petal::TranslationService::MOFile->new ($mo_file_absolute_path); } 1; __END__ Petal-2.25/lib/Petal/TranslationService/PaxHeaders.604/Noop.pm0000644000000000000000000000007311714720667021017 xustar0029 atime=1398329059.85646357 30 ctime=1550088055.149412525 Petal-2.25/lib/Petal/TranslationService/Noop.pm0000644000175000001440000000032311714720667021573 0ustar00nineusers00000000000000package Petal::TranslationService::Noop; use warnings; use strict; sub new { my $class = shift; return bless {}, $class; } sub maketext { my $self = shift; return join '', @_; } 1; __END__ Petal-2.25/lib/Petal/TranslationService/PaxHeaders.604/MOFile.pm0000644000000000000000000000007311714720667021217 xustar0029 atime=1398329059.85646357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/TranslationService/MOFile.pm0000644000175000001440000000170311714720667021776 0ustar00nineusers00000000000000package Petal::TranslationService::MOFile; use Locale::Maketext::Gettext; use Encode; use strict; use warnings; sub new { my $class = shift; my $file = shift || do { warn "No file specified for " . __PACKAGE__ . "::new (\$file)"; return bless {}, $class; }; -e $file or do { warn "$file does not seem to exist"; return bless {}, $class; }; -f $file or do { warn "$file does not seem to be a file"; return bless {}, $class; }; my $self = bless { file => $file }, $class; $self->{lexicon} = { read_mo ($file) }; ($self->{encoding}) = $self->{lexicon}{""} =~ /^Content-Type: text\/plain; charset=(.*)$/im; return $self; } sub maketext { my $self = shift; my $id = shift || return; $self->{lexicon} || return; my $res = $self->{lexicon}->{$id}; return undef unless defined $res; return decode($self->{encoding}, $res); } 1; __END__ Petal-2.25/lib/Petal/PaxHeaders.604/CodeGenerator.pm0000644000000000000000000000013213431073217016770 xustar0030 mtime=1550087823.268680777 30 atime=1550087823.268680777 30 ctime=1550088055.141412499 Petal-2.25/lib/Petal/CodeGenerator.pm0000644000175000001440000003705613431073217017565 0ustar00nineusers00000000000000package Petal::CodeGenerator::Decode; use strict; use warnings; use base qw /MKDoc::XML::Decode/; ## # $class->process ($xml); # ----------------------- # Expands the entities ' " > < and & # into their ascii equivalents. ## sub process { (@_ == 2) or warn "MKDoc::XML::Encode::process() should be called with two arguments"; my $self = shift; my $data = join '', @_; $data =~ s/&(#?[0-9A-Za-z]+)\\;/$self->entity_to_char ($1)/eg; return $data; } # ------------------------------------------------------------------ # Petal::CodeGenerator - Generates Perl code from canonical syntax # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: This class parses a template in 'canonical syntax' # (referred as the 'UGLY SYNTAX' in the manual) and generates Perl # code that can be turned into a subroutine using eval(). # ------------------------------------------------------------------ package Petal::CodeGenerator; use MKDoc::XML::Decode; use strict; use warnings; use Carp; our $PI_RE = '^<\?(?:\s|\r|\n)*(attr|include|var|if|condition|else|repeat|loop|foreach|for|eval|endeval|end|defslot).*?\?>$'; use vars qw /$petal_object $tokens $variables @code $indentLevel $token_name %token_hash $token $my_array/; sub indent_increment { my $class = shift; $Petal::CodeGenerator::indentLevel++; } sub indent_decrement { my $class = shift; $Petal::CodeGenerator::indentLevel--; } sub indent { my $class = shift; return $Petal::CodeGenerator::indentLevel; } # these _xxx_res primitives have been contributed by Fergal Daly # they speed up string construction a little bit sub _init_res { return '$res = ""'; } sub _add_res { my $class = shift; my $thing = shift; return qq{\$res .= $thing}; } sub _final_res { return q{$res}; } sub _get_res { return q{$res}; } sub add_code { my $class = shift; push(@code, " " x $class->indent() . shift); } sub comp_expr { my $self = shift; my $expr = shift; return "\$hash->get ('$expr')"; } sub comp_expr_encoded { my $self = shift; my $expr = shift; return "\$hash->get_encoded ('$expr')"; } # $class->code_header(); # ---------------------- # This generates the beginning of the anonymous subroutine. sub code_header { my $class = shift; $class->add_code("\$VAR1 = sub {"); $class->indent_increment(); $class->add_code("my \$hash = shift;"); $class->add_code("my ".$class->_init_res.";"); $class->add_code('local $^W = 0;') unless $Petal::WARN_UNINIT; } # $class->code_footer(); # ---------------------- # This generates the tail of the anonymous subroutine sub code_footer { my $class = shift; $class->add_code("return ". $class->_final_res() .";"); $class->indent_decrement(); $class->add_code("};"); } # $class->process ($data_ref, $petal_object); # ------------------------------------------- # This (too big) subroutine converts the canonicalized template # data into Perl code which is ready to be evaled and executed. sub process { my $class = shift; my $data_ref = shift; local $petal_object = shift || die "$class::" . "process: \$petal_object was not defined"; local $tokens = $class->_tokenize ($data_ref); local $variables = {}; local @code = (); local $Petal::CodeGenerator::indentLevel = 0; local $token_name = undef; local %token_hash = (); local $token = undef; local $my_array = {}; $class->code_header(); foreach $token (@{$tokens}) { if ($token =~ /$PI_RE/s) { ($token_name) = $token =~ /$PI_RE/s; my @atts1 = $token =~ /(\S+)\=\"(.*?)\"/gos; my @atts2 = $token =~ /(\S+)\=\'(.*?)\'/gos; %token_hash = (@atts1, @atts2); foreach my $key (%token_hash) { $token_hash{$key} = $class->_decode_backslash_semicolon ($token_hash{$key}) if (defined $token_hash{$key}); } CASE: for ($token_name) { /^attr$/ and do { $class->_attr; last CASE }; /^include$/ and do { $class->_include; last CASE }; /^var$/ and do { $class->_var; last CASE }; /^if$/ and do { $class->_if; last CASE }; /^condition$/ and do { $class->_if; last CASE }; /^else$/ and do { $class->_else; last CASE }; /^repeat$/ and do { $class->_for; last CASE }; /^loop$/ and do { $class->_for; last CASE }; /^foreach$/ and do { $class->_for; last CASE }; /^for$/ and do { $class->_for; last CASE }; /^eval$/ and do { $class->_eval; last CASE }; /^endeval$/ and do { $class->_endeval; last CASE }; /^defslot$/ and do { $class->_defslot; last CASE }; /^end$/ and do { my $idt = $class->indent(); delete $my_array->{$idt}; $class->indent_decrement(); $class->add_code("};"); last CASE; }; } } else { my $string = quotemeta ($token); # $string =~ s/\@/\\\@/gsm; # $string =~ s/\$/\\\$/gsm; # $string =~ s/\n/\\n/gsm; # $string =~ s/\n//gsm; # $string =~ s/\"/\\\"/gsm; $class->add_code($class->_add_res( '"' . $string . '";')); } } $class->code_footer(); return join "\n", @code; } # $class->_include; # ----------------- # process a file sub _include { my $class = shift; my $file = $token_hash{file}; my $path = $petal_object->_include_compute_path ($file); my $lang = $petal_object->language(); $class->add_code ($class->_add_res ("do {")); $class->indent_increment(); my $included_from = $petal_object->_file(); $included_from =~ s/\#.*$//; $class->add_code ("do {"); $class->indent_increment(); $class->add_code ("my \$new_hash = \$hash->new();"); $class->add_code ("\$new_hash->{__included_from__} = '$included_from';"); (defined $lang and $lang) ? $class->add_code ("my \$res = eval { Petal->new (file => '$path', lang => '$lang')->process (\$new_hash) };") : $class->add_code ("my \$res = eval { Petal->new ('$path')->process (\$new_hash) };"); $class->add_code ("if (\$@) { confess(\$@); }") if $Petal::ERROR_ON_INCLUDE_ERROR; $class->add_code ("\$res = \"\" if (defined \$\@ and \$\@);"); $class->add_code ("\$res;"); $class->indent_decrement(); $class->add_code ("} || '';"); $class->indent_decrement(); $class->add_code ("};"); } # $class->_defslot; # --------------------- # process a statement sub _defslot { my $class = shift; my $variable = $token_hash{name} or confess "Cannot parse $token : 'name' attribute is not defined"; (defined $variable and $variable) or confess "Cannot parse $token : 'name' attribute is not defined"; # set the variable in the $variables hash my $tmp = $variable; $tmp =~ s/\..*//; $variables->{$tmp} = 1; $variable =~ s/\'/\\\'/g; $class->add_code ("do {"); $class->indent_increment(); $class->add_code ("my \$tmp = undef;"); $class->add_code ("\$hash->{__included_from__} && do {"); $class->indent_increment(); $class->add_code ("my \$path = \$hash->{__included_from__} . '#$variable';"); $class->add_code ("my \$new_hash = \$hash->new();"); $class->add_code ("delete \$new_hash->{__included_from__};"); my $lang = $petal_object->language(); (defined $lang and $lang) ? $class->add_code ("\$tmp = eval { Petal->new (file => \$path, lang => '$lang')->process (\$new_hash) };") : $class->add_code ("\$tmp = eval { Petal->new (\$path)->process (\$new_hash) };"); $class->add_code ("if (\$@) { confess(\$@); }") if $Petal::ERROR_ON_INCLUDE_ERROR; $class->indent_decrement(); $class->add_code ("};"); $class->add_code ("if (\$tmp) {"); $class->indent_increment(); $class->add_code ( $class->_add_res ("\$tmp") ); $class->indent_decrement(); $class->add_code ( "} else {" ); $class->indent_increment(); } # $class->_var; # ------------- # process a statement sub _var { my $class = shift; my $variable = $token_hash{name} or confess "Cannot parse $token : 'name' attribute is not defined"; (defined $variable and $variable) or confess "Cannot parse $token : 'name' attribute is not defined"; # set the variable in the $variables hash my $tmp = $variable; $tmp =~ s/\..*//; $variables->{$tmp} = 1; $variable =~ s/\'/\\\'/g; $class->add_code ( $class->_add_res (('do {')) ); $class->indent_increment(); $class->add_code ('my $res = ' . $class->comp_expr_encoded ($variable) . ';'); $class->add_code ('(defined $res) ? $res : "";'); $class->indent_decrement(); $class->add_code ('};'); } # $class->_if; # ------------ # process a statement sub _if { my $class = shift; my $variable = $token_hash{name} or confess "Cannot parse $token : 'name' attribute is not defined"; (defined $variable and $variable) or confess "Cannot parse $token : 'name' attribute is not defined"; # set the variable in the $variables hash my $tmp = $variable; $tmp =~ s/\..*//; $variables->{$tmp} = 1; $variable =~ s/\'/\\\'/g; $class->add_code("if (".$class->comp_expr($variable).") {"); $class->indent_increment(); } # $class->_eval; # ------------------- # process a statement sub _eval { my $class = shift; $class->add_code($class->_add_res("eval {")); $class->indent_increment(); $class->add_code("my " . $class->_init_res() .";"); $class->add_code("local %SIG;"); $class->add_code("\$SIG{__DIE__} = sub { \$\@ = shift };"); } # $class->_endeval; # ----------------- # process a statement sub _endeval { my $class = shift; my $variable = $token_hash{'errormsg'} or confess "Cannot parse $token : 'errormsg' attribute is not defined"; $class->add_code("return " . $class->_get_res() . ";"); $class->indent_decrement(); $class->add_code("} || '';"); $class->add_code("if (defined \$\@ and \$\@) {"); $class->indent_increment(); $variable =~ s/\&/&/g; $variable =~ s/\/>/g; $variable =~ s/\"/"/g; $variable = quotemeta ($variable); $class->add_code($class->_add_res("\"$variable\";")); $class->indent_decrement(); $class->add_code("}"); } # $class->_attr; # -------------- # process a statement sub _attr { my $class = shift; my $attribute = $token_hash{name} or confess "Cannot parse $token : 'name' attribute is not defined"; my $variable = $token_hash{value} or confess "Cannot parse $token : 'value' attribute is not defined"; (defined $variable and $variable) or confess "Cannot parse $token : 'value' attribute is not defined"; # set the variable in the $variables hash my $tmp = $variable; $tmp =~ s/\..*//; $variables->{$tmp} = 1; $variable =~ s/\'/\\\'/g; $class->add_code('{'); $class->indent_increment(); $class->add_code ("my \$value = " . $class->comp_expr_encoded($variable) . ";"); $class->add_code ("if (defined(\$value)) {"); # $class->add_code ("if (defined(\$value) and length(\$value)) {"); $class->indent_increment(); $class->add_code ($class->_add_res (qq {"$attribute=\\"\$value\\""}) ); $class->indent_decrement(); $class->add_code ("}"); $class->indent_decrement(); $class->add_code ("}"); } # $class->_else; # -------------- # process a statement sub _else { my $class = shift; $class->indent_decrement(); $class->add_code("}"); $class->add_code("else {"); $class->indent_increment(); } # $class->_for; # ------------- # process a statement sub _for { my $class = shift; my $variable = $token_hash{name} or confess "Cannot parse $token : 'name' attribute is not defined"; (defined $variable and $variable) or confess "Cannot parse $token : 'name' attribute is not defined"; $variable =~ s/^\s+//; my $as; ($as, $variable) = split /\s+/, $variable, 2; (defined $as and defined $variable) or confess "Cannot parse $token : loop name not specified"; # set the variable in the $variables hash my $tmp = $variable; $tmp =~ s/\..*//; $variables->{$tmp} = 1; my $idt = $class->indent(); $variable =~ s/\'/\\\'/g; unless (defined $my_array->{$idt}) { $class->add_code("my \$array = ".$class->comp_expr($variable).";"); $class->add_code( qq{die 'tried to repeat but $variable gave no array reference'} . qq{ unless defined \$array and ref \$array eq 'ARRAY';} ); $class->add_code("my \@array = \@\$array;"); $my_array->{$idt} = 1; } else { #$class->add_code("\@array = \@{".$class->comp_expr($variable)."};"); $class->add_code("\$array = ".$class->comp_expr($variable).";"); $class->add_code( qq{die 'tried to repeat but $variable gave no array reference'} . qq{ unless defined \$array and ref \$array eq 'ARRAY';} ); $class->add_code("\@array = \@\$array;"); } $class->add_code ("for (my \$i=0; \$i < \@array; \$i++) {"); $class->indent_increment(); $class->add_code ("my \$hash = \$hash->new();"); # compute various might-be-useful variables $class->add_code ("my \$number = \$i + 1;"); $class->add_code ("my \$odd = \$number % 2;"); $class->add_code ("my \$even = \$i % 2;"); $class->add_code ("my \$start = (\$i == 0);"); $class->add_code ("my \$end = (\$i == \$#array);"); $class->add_code ("my \$inner = (\$i and \$i < \@array);"); # backwards compatibility $class->add_code ("\$hash->{__count__} = \$number;"); $class->add_code ("\$hash->{__is_first__} = \$start;"); $class->add_code ("\$hash->{__is_last__} = \$end;"); $class->add_code ("\$hash->{__is_inner__} = \$inner;"); $class->add_code ("\$hash->{__even__} = \$even;"); $class->add_code ("\$hash->{__odd__} = \$odd;"); # new repeat style object $class->add_code ("\$hash->{repeat} = {"); $class->indent_increment(); $class->add_code ("index => \$i,"); $class->add_code ("number => \$number,"); $class->add_code ("even => \$even,"); $class->add_code ("odd => \$odd,"); $class->add_code ("start => \$start,"); $class->add_code ("end => \$end,"); $class->add_code ("inner => \$inner,"); $class->add_code ("};"); $class->indent_decrement(); $class->add_code ("\$hash->{'$as'} = \$array[\$i];"); } # $class->_tokenize ($data_ref); # ------------------------------ # Returns the data to process as a list of tokens: # ( 'some text', '<% a_tag %>', 'some more text', '<% end-a_tag %>' etc. sub _tokenize { my $self = shift; my $data_ref = shift; my @tags = $$data_ref =~ /(<\?.*?\?>)/gs; my @split = split /(?:<\?.*?\?>)/s, $$data_ref; my $tokens = []; while (@split) { push @{$tokens}, shift (@split); push @{$tokens}, shift (@tags) if (@tags); } push @{$tokens}, (@tags); return $tokens; } sub _decode_backslash_semicolon { my $class = shift; my $data = shift; my $decode = new Petal::CodeGenerator::Decode ('xml'); return $decode->process ($data); } 1; Petal-2.25/lib/Petal/PaxHeaders.604/Cache0000644000000000000000000000013213431073567014647 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.149412525 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Cache/0000755000175000001440000000000013431073567015506 5ustar00nineusers00000000000000Petal-2.25/lib/Petal/Cache/PaxHeaders.604/Disk.pm0000644000000000000000000000013213431073217016144 xustar0030 mtime=1550087823.268680777 30 atime=1550087823.268680777 30 ctime=1550088055.149412525 Petal-2.25/lib/Petal/Cache/Disk.pm0000644000175000001440000001067113431073217016733 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Cache::Disk - Caches generated code on disk. # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: A simple cache module to avoid re-generating the Perl # code from the template file every time # ------------------------------------------------------------------ package Petal::Cache::Disk; use strict; use warnings; use File::Spec; use Digest::MD5 qw /md5_hex/; use Carp; # kill silly warnings sub sillyness { + $Petal::INPUT && + $Petal::OUTPUT; } # local $Petal::Cache::Disk::TMP_DIR = # defaults to File::Spec->tmpdir; our $TMP_DIR = File::Spec->tmpdir; # local $Petal::Cache::Disk::PREFIX = # defaults to 'petal_cache_' our $PREFIX = 'petal_cache'; # $class->get ($file, $lang); # -------------------- # Returns the cached data if its last modification time is more # recent than the last modification time of the template # Returns the code for template file $file, undef otherwise sub get { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); return $class->cached ($key) if ($class->is_ok ($file, $lang)); return; } # $class->set ($file, $code, $lang); # --------------------------- # Sets the cached code for $file + $lang sub set { my $class = shift; my $file = shift; my $code = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); my $tmp = $class->tmp; { if ($] > 5.007) { open FP, ">:utf8", "$tmp/$key" or ( Carp::cluck "Cannot write-open $tmp/$key ($!)" and return ); } else { open FP, ">$tmp/$key" or ( Carp::cluck "Cannot write-open $tmp/$key ($!)" and return ); } print FP $code; close FP; } } # $class->is_ok ($file, $lang); # ---------------------- # Returns TRUE if the cache is still fresh, FALSE otherwise. sub is_ok { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); my $tmp = $class->tmp; my $tmp_file = "$tmp/$key"; return unless (-e $tmp_file); my $cached_mtime = $class->cached_mtime ($file, $lang); my $current_mtime = $class->current_mtime ($file); return $cached_mtime >= $current_mtime; } # $class->compute_key ($file, $lang); # ---------------------------- # Computes a cache 'key' for $file+$lang, which should be unique. # (Well, currently an MD5 checksum is used, which is not # *exactly* unique but which should be good enough) sub compute_key { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = md5_hex ($file . ";$lang" . ";INPUT=" . $Petal::INPUT . ";OUTPUT=" . $Petal::OUTPUT); $key = $PREFIX . "_" . $Petal::VERSION . "_" . $key if (defined $PREFIX); return $key; } # $class->cached_mtime ($file, $lang); # ----------------------------- # Returns the last modification date of the cached data # for $file + $lang sub cached_mtime { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); my $tmp = $class->tmp; my $tmp_file = "$tmp/$key"; my $mtime = (stat($tmp_file))[9]; return $mtime; } # $class->current_mtime ($file); # ------------------------------ # Returns the last modification date for $file sub current_mtime { my $class = shift; my $file = shift; $file =~ s/#.*$//; my $mtime = (stat($file))[9]; return $mtime; } # $class->cached ($key); # ---------------------- # Returns the cached data for $key sub cached { my $class = shift; my $key = shift; my $tmp = $class->tmp; my $cached_filepath = $tmp . '/' . $key; (-e $cached_filepath) or return; my $res = undef; { if ($] > 5.007) { open FP, "<:utf8", "$tmp/$key" or ( Carp::cluck "Cannot read-open $tmp/$key ($!)" and return ); } else { open FP, "<$tmp/$key" or ( Carp::cluck "Cannot read-open $tmp/$key ($!)" and return ); } $res = join '', ; close FP; } return $res; } # $class->tmp; # ------------ # Returns the temp directory in which the cached data is kept. sub tmp { my $class = shift; $TMP_DIR ||= File::Spec->tmpdir; (-e $TMP_DIR) or confess "\$TMP_DIR '$TMP_DIR' does not exist"; (-d $TMP_DIR) or confess "\$TMP_DIR '$TMP_DIR' is not a directory"; $TMP_DIR =~ s/\/+$//; return $TMP_DIR; } 1; Petal-2.25/lib/Petal/Cache/PaxHeaders.604/Memory.pm0000644000000000000000000000007312200721256016522 xustar0029 atime=1398329059.84446357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Cache/Memory.pm0000644000175000001440000000547312200721256017311 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Cache::Memory - Caches generated subroutines in memory. # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: A simple cache module to avoid re-compiling the Perl # code from the Perl data at each request. # ------------------------------------------------------------------ package Petal::Cache::Memory; use strict; use warnings; use Carp; our $FILE_TO_SUBS = {}; our $FILE_TO_MTIME = {}; sub sillyness { + $Petal::INPUT && $Petal::OUTPUT; } # $class->get ($file, $lang); # -------------------- # Returns the cached subroutine if its last modification time # is more recent than the last modification time of the template, # returns undef otherwise sub get { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); return $FILE_TO_SUBS->{$key} if ($class->is_ok ($file, $lang)); return; } # $class->set ($file, $code, $lang); # --------------------------- # Sets the cached code for $file. sub set { my $class = shift; my $file = shift; my $code = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); $FILE_TO_SUBS->{$key} = $code; $FILE_TO_MTIME->{$key} = $class->current_mtime ($file); } # $class->is_ok ($file, $lang); # ---------------------- # Returns TRUE if the cache is still fresh, FALSE otherwise. sub is_ok { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); return unless (defined $FILE_TO_SUBS->{$key}); my $cached_mtime = $class->cached_mtime ($file, $lang); my $current_mtime = $class->current_mtime ($file); return $cached_mtime >= $current_mtime; } # $class->cached_mtime ($file, $lang); # ----------------------------- # Returns the last modification date of the cached data # for $file & $lang sub cached_mtime { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $class->compute_key ($file, $lang); return $FILE_TO_MTIME->{$key}; } # $class->current_mtime ($file); # ------------------------------ # Returns the last modification date for $file sub current_mtime { my $class = shift; my $file = shift; $file =~ s/#.*$//; my $mtime = (stat($file))[9]; return $mtime; } # $class->compute_key ($file); # ---------------------------- # Computes a cache 'key' for $file, which should be unique. # (Well, currently an MD5 checksum is used, which is not # *exactly* unique but which should be good enough) sub compute_key { my $class = shift; my $file = shift; my $lang = shift || ''; my $key = $file . ";$lang" . ";INPUT=" . $Petal::INPUT . ";OUTPUT=" . $Petal::OUTPUT; return $key; } 1; Petal-2.25/lib/Petal/PaxHeaders.604/Canonicalizer0000644000000000000000000000013213431073567016425 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.149412525 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Canonicalizer/0000755000175000001440000000000013431073567017264 5ustar00nineusers00000000000000Petal-2.25/lib/Petal/Canonicalizer/PaxHeaders.604/XML.pm0000644000000000000000000000007311714720667017506 xustar0029 atime=1398329059.84846357 30 ctime=1550088055.149412525 Petal-2.25/lib/Petal/Canonicalizer/XML.pm0000644000175000001440000004213311714720667020267 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Canonicalizer::XML - Builds an XML canonical Petal file # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: This modules mainly implements the XML::Parser # 'Stream' interface. It receives XML events and builds Petal # canonical data, i.e. # # Hello # # Might be canonicalized to something like # # # Hello # # ------------------------------------------------------------------ package Petal::Canonicalizer::XML; use Petal::Hash::String; use MKDoc::XML::Encode; use strict; use warnings; use vars qw /@Result @NodeStack/; # $class->process ($parser, $data_ref); # ------------------------------------- # returns undef if $parser object (i.e. a Petal::Parser::XML object) # could not parse the data which $data_ref pointed to. # # returns a reference to the canonicalized string otherwise. sub process { my $class = shift; my $parser = shift; my $data_ref = shift; $data_ref = (ref $data_ref) ? $data_ref : \$data_ref; # grab anything that's before the first '<' tag my ($header) = $$data_ref =~ /(^.*?)<(?!\?|\!)/sm; $$data_ref =~ s/(^.*?)<(?!\?|\!)/\ tags which the parser is going to strip # in order to reinclude them afterwards # my @decls = $$data_ref =~ /()/gsm; # take the existing processing instructions out and replace # them with temporary xml-friendly handlers my $pis = $class->_processing_instructions_out ($data_ref); local @Result = (); local @NodeStack = (); $parser->process ($class, $data_ref); $header ||= ''; my $res = ''; $res .= $header unless ($Petal::CURRENT_INCLUDES > 1); $res .= (join '', @Result); $class->_processing_instructions_in (\$res, $pis); return \$res; } # _processing_instructions_out ($data_ref); # ----------------------------------------- # takes the existing processing instructions (i.e. ) # and replace them with temporary xml-friendly handlers (i.e. # [-- NBXNBBJBNJNBJVNK --] # # returns the => [-- NBXNBBJBNJNBJVNK --] mapping # as a hashref # # NOTE: This is because processing instructions are special to # HTML::Parser, XML::Parser etc. and it's easier to just handle # them separately sub _processing_instructions_out { my $class = shift; my $data_ref = shift; my %pis = map { $_ => $class->_compute_unique_string ($data_ref) } $$data_ref =~ /(<\?.*?\?>)/gsm; while (my ($key, $value) = each %pis) { $$data_ref =~ s/\Q$key\E/$value/gsm; } return \%pis; } # _processing_instructions_in ($data_ref, $pis); # ---------------------------------------------- # takes the processing instructions mapping defined in the $pis # hashref and restores the processing instructions in the data # pointed by $data_ref sub _processing_instructions_in { my $class = shift; my $data_ref = shift; my $pis = shift; while (my ($key, $value) = each %{$pis}) { $$data_ref =~ s/\Q$value\E/$key/gsm; } } # _compute_unique_string ($data_ref) # ---------------------------------- # computes a string which does not exist in $$data_ref sub _compute_unique_string { my $class = shift; my $data_ref = shift; my $string = '[-' . (join '', map { chr (ord ('a') + int rand 26) } 1..20) . '-]'; while (index ($$data_ref, $string) >= 0) { $string = '[-' . (join '', map { chr (ord ('a') + int rand 26) } 1..20) . '-]'; } return $string; } # $class->StartTag(); # ------------------- # Called for every start tag with a second parameter of the element type. # It will check for special PETAL attributes like petal:if, petal:loop, etc... # and rewrite the start tag into @Result accordingly. # # For example # # # # Is rewritten # # ... sub StartTag { Petal::load_code_generator(); # we will use it later my $class = shift; push @NodeStack, {}; return if ($class->_is_inside_content_or_replace()); my $tag = $_; ($tag) = $tag =~ /^<\s*((?:\w|\:|\-)*)/; my $att = { %_ }; $class->_use_macro ($tag, $att); $class->_on_error ($tag, $att); $class->_define ($tag, $att); $class->_define_slot ($tag, $att); $class->_condition ($tag, $att); $class->_repeat ($tag, $att); $class->_is_xinclude ($tag) and $class->_xinclude ($tag, $att) and return; $class->_replace ($tag, $att); my $petal = quotemeta ($Petal::NS); # if a petal:replace attribute was set, then at this point _is_inside_content_or_replace() # should return TRUE and this code should not be executed unless ($class->_is_inside_content_or_replace()) { # for every attribute which is not a petal: attribute, # we need to convert $variable into foreach my $key (keys %{$att}) { next if ($key =~ /^$petal:/); my $text = $att->{$key}; my $token_re = $Petal::Hash::String::TOKEN_RE; my @vars = $text =~ /$token_re/gsm; my %vars = map { $_ => 1 } @vars; @vars = sort { length ($b) <=> length ($a) } keys %vars; foreach my $var (@vars) { my $command = $var; $command =~ s/^\$//; $command =~ s/^\{//; $command =~ s/\}$//; $command = $class->_encode_backslash_semicolon ($command); $command = ""; $text =~ s/\Q$var\E/$command/g; } $att->{$key} = $text; } # processes the petal:attributes instruction $class->_attributes ($tag, $att); my @att_str = (); foreach my $key (keys %{$att}) { next if ($key =~ /^$petal:/); my $value = $att->{$key}; if ($value =~ /^<\?attr/) { push @att_str, $value; } else { my $tokens = Petal::CodeGenerator->_tokenize (\$value); my @res = map { ($_ =~ /$Petal::CodeGenerator::PI_RE/s) ? $_ : do { $_ =~ s/\&/&/g; $_ =~ s/\/>/g; $_ =~ s/\"/"/g; $_; }; } @{$tokens}; push @att_str, $key . '="' . (join '', @res) . '"'; } } my $att_str = join " ", @att_str; if (defined $att->{"$petal:omit-tag"}) { my $expression = $att->{"$petal:omit-tag"} || 'string:1'; $NodeStack[$#NodeStack]->{'omit-tag'} = $expression; push @Result, (defined $att_str and $att_str) ? "<$tag $att_str>" : "<$tag>"; } else { push @Result, (defined $att_str and $att_str) ? "<$tag $att_str>" : "<$tag>"; } $class->_content ($tag, $att); } } # $class->EndTag(); # ----------------- # Called for every end tag with a second parameter of the element type. # It will check in the @NodeStack to see if this end-tag also needs to close # some 'condition' or 'repeat' statements, i.e. # #
  • # # Could be rewritten # # # # If the starting LI used a loop, i.e.
  • sub EndTag { my $class = shift; return if ($class->_is_inside_content_or_replace ( 'endtag' )); my ($tag) = $_ =~ /^<\/\s*((?:\w|\:|\-)*)/; my $node = pop (@NodeStack); return if ($class->_is_xinclude ($tag)); unless (defined $node->{replace} and $node->{replace}) { if (exists $node->{'omit-tag'}) { my $expression = $node->{'omit-tag'}; push @Result, ""; } else { push @Result, ""; } } my $repeat = $node->{repeat} || '0'; my $condition = $node->{condition} || '0'; my $define_slot = $node->{define_slot} || '0'; push @Result, map { '' } 1 .. ($repeat+$condition+$define_slot); unless (defined $node->{replace} and $node->{replace}) { if (exists $node->{'on-error'}) { my $expression = $node->{'on-error'}; push @Result, ""; } } } # $class->Text(); # --------------- # Called just before start or end tags. # Turns all variables such as $foo:bar into sub Text { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $text = $_; my $token_re = $Petal::Hash::String::TOKEN_RE; my @vars = $text =~ /$token_re/gsm; my %vars = map { $_ => 1 } @vars; @vars = sort { length ($b) <=> length ($a) } keys %vars; foreach my $var (@vars) { my $command = $var; $command =~ s/^\$//; $command =~ s/^\{//; $command =~ s/\}$//; $command = $class->_encode_backslash_semicolon ($command); $command = ""; $text =~ s/\Q$var\E/$command/g; } push @Result, $text; } # _is_inside_content_or_replace(); # -------------------------------- # Returns TRUE if @NodeStack contains a node which has a # 'content' or a 'replace' attribute set. sub _is_inside_content_or_replace { my $class = shift; my $endtag = shift; my $tmp = undef; $tmp = pop (@NodeStack) if ($endtag); # WHY do I have to do this? return 1 if (defined $tmp and $tmp->{'use-macro'}); for (my $i=@NodeStack - 1; $i >= 0; $i--) { return 1 if ( defined $NodeStack[$i]->{'replace'} or defined $NodeStack[$i]->{'content'} or defined $NodeStack[$i]->{'use-macro'} ); } push @NodeStack, $tmp if (defined $tmp); return; } # _split_expression ($expr); # -------------------------- # Splits multiple semicolon separated expressions, which # are mainly used for the petal:attributes attribute, i.e. # would turn "href document.uri; lang document.lang; xml:lang document.lang" # into ("href document.uri", "lang document.lang", "xml:lang document.lang") sub _split_expression { my $class = shift; my $expression = shift; my @tokens = map { (defined $_ and $_) ? $_ : () } split /(\s|\r|\n)*(? statements into # sub _on_error { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = quotemeta ($Petal::NS); my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:on-error"} || return; $expr = $class->_encode_backslash_semicolon ($expr); push @Result, ""; $NodeStack[$#NodeStack]->{'on-error'} = $expr; return 1; } # _define; # -------- # Rewrites statements into # canonical sub _define { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = $Petal::NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:set"} || delete $att->{"$petal:def"} || delete $att->{"$petal:define"} || return; $expr = $class->_encode_backslash_semicolon ($expr); push @Result, map { "" } $class->_split_expression ($expr); return 1; } # _condition; # ----------- # Rewrites statements into # sub _condition { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = $Petal::NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:if"} || delete $att->{"$petal:condition"} || return; $expr = $class->_encode_backslash_semicolon ($expr); my @new = map { "" } $class->_split_expression ($expr); push @Result, @new; $NodeStack[$#NodeStack]->{condition} = scalar @new; return 1; } # _define_slot; # ----------- # Rewrites statements into # sub _define_slot { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $metal = $Petal::MT_NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$metal:define-slot"} || return; $expr = $class->_encode_backslash_semicolon ($expr); my @new = map { "" } $class->_split_expression ($expr); push @Result, @new; $NodeStack[$#NodeStack]->{define_slot} = 2 * scalar @new; return 1; } # _repeat; # -------- # Rewrites statements into # sub _repeat { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = $Petal::NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:for"} || delete $att->{"$petal:foreach"} || delete $att->{"$petal:loop"} || delete $att->{"$petal:repeat"} || return; my @exprs = $class->_split_expression ($expr); my @new = (); foreach $expr (@exprs) { $expr = $class->_encode_backslash_semicolon ($expr); push @new, "" } push @Result, @new; $NodeStack[$#NodeStack]->{repeat} = scalar @new; return 1; } # _replace; # --------- # Rewrites as # All the descendent nodes of 'tag' will be skipped sub _replace { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = $Petal::NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:replace"} || delete $att->{"$petal:outer"} || return; my @new = map { $_ = $class->_encode_backslash_semicolon ($_); ""; } $class->_split_expression ($expr); push @Result, @new; $NodeStack[$#NodeStack]->{replace} = 'true'; return 1; } # _use_macro; # ----------- # Rewrites # All the descendent nodes of 'tag' will be skipped sub _use_macro { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $metal = $Petal::MT_NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$metal:use-macro"} || return; push @Result, qq||; $NodeStack[$#NodeStack]->{'use-macro'} = 'true'; return 1; } # _attributes; # ------------ # Rewrites # as sub _attributes { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = $Petal::NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:att"} || delete $att->{"$petal:attr"} || delete $att->{"$petal:atts"} || delete $att->{"$petal:attributes"} || return; foreach my $string ($class->_split_expression ($expr)) { next unless (defined $string); next if ($string =~ /^\s*$/); my ($attr, $expr) = $string =~ /^\s*([A-Za-z_:][A-Za-z0-9_:.-]*)\s+(.*?)\s*$/; if (not defined $attr or not defined $expr) { warn "Attributes expression '$string' does not seem valid - Skipped"; next; } $expr = $class->_encode_backslash_semicolon ($expr); $att->{$attr} = ""; } return 1; } # _content; # --------- # Rewrites as # All the descendent nodes of 'tag' will be skipped sub _content { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $petal = $Petal::NS; my $tag = shift; my $att = shift; my $expr = delete $att->{"$petal:content"} || delete $att->{"$petal:contents"} || delete $att->{"$petal:inner"} || return; my @new = map { $_ = $class->_encode_backslash_semicolon ($_); ""; } $class->_split_expression ($expr); push @Result, @new; $NodeStack[$#NodeStack]->{content} = 'true'; return 1; } # _xinclude ($tag, $att); # ----------------------- # Rewrites into # . sub _xinclude { my $class = shift; return if ($class->_is_inside_content_or_replace()); my $tag = shift; my $att = shift; if ($class->_is_xinclude ($tag)) { # strip remaining Petal tags my $petal = quotemeta ($Petal::NS); $att = { map { $_ =~ /^$petal:/ ? () : $_ => $att->{$_} } keys %{$att} }; my $expr = delete $att->{'href'}; $expr = $class->_encode_backslash_semicolon ($expr); push @Result, ""; } return 1; } # _is_xinclude ($tag); # -------------------- # Returns TRUE if $tag is a Xinclude directive, # FALSE otherwise. sub _is_xinclude { my $class = shift; my $tag = shift; my $xi = quotemeta ($Petal::XI_NS); return $tag =~ /^$xi:/ } sub _encode_backslash_semicolon { my $class = shift; my $data = shift; $data =~ s/($MKDoc::XML::Encode::XML_Encode_Pattern)/&$MKDoc::XML::Encode::XML_Encode{$1}\\;/go; return $data; } 1; __END__ Petal-2.25/lib/Petal/Canonicalizer/PaxHeaders.604/XHTML.pm0000644000000000000000000000007311714720667017742 xustar0029 atime=1398329059.84446357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Canonicalizer/XHTML.pm0000644000175000001440000001612611714720667020526 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Canonicalizer::XHTML - Builds an XHTML canonical Petal file # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: This modules mainly implements the XML::Parser # 'Stream' interface. It receives XML events and builds Petal # canonical data, i.e. # # Hello # # Might be canonicalized to something like # # # Hello # # # On top of that, Petal::Canonicalizer::XHTML will self close certain # XHTML specific tags, like
    or # ------------------------------------------------------------------ package Petal::Canonicalizer::XHTML; use strict; use warnings; use base qw /Petal::Canonicalizer::XML/; # http://lists.webarch.co.uk/pipermail/petal/2002-August/000074.html # here's a list[1] of empty elements (which need careful handling): # # ---8<--- # area # base # basefont # br # col # frame # hr # img # input # isindex # link # meta # param # --->8--- # # [1] http://www.w3.org/TR/html401/index/elements.html # $class->StartTag(); # ------------------- # Called for every start tag with a second parameter of the element type. # It will check for special PETAL attributes like petal:if, petal:loop, etc... # and rewrite the start tag into @Petal::Canonicalizer::XML::Result accordingly. # # For example # # # Is rewritten # ... sub StartTag { Petal::load_code_generator(); # we will use it later my $class = shift; push @Petal::Canonicalizer::XML::NodeStack, {}; return if ($class->_is_inside_content_or_replace()); my $tag = $_; ($tag) = $tag =~ /^<\s*((?:\w|\:|\-)*)/; my $att = { %_ }; $class->_use_macro ($tag, $att); $class->_on_error ($tag, $att); $class->_define ($tag, $att); $class->_define_slot ($tag, $att); $class->_condition ($tag, $att); $class->_repeat ($tag, $att); $class->_is_xinclude ($tag) and $class->_xinclude ($tag, $att) and return; $class->_replace ($tag, $att); my $petal = quotemeta ($Petal::NS); # if a petal:replace attribute was set, then at this point _is_inside_content_or_replace() # should return TRUE and this code should not be executed unless ($class->_is_inside_content_or_replace()) { # for every attribute which is not a petal: attribute, # we need to convert $variable into foreach my $key (keys %{$att}) { next if ($key =~ /^$petal:/); my $text = $att->{$key}; my $token_re = $Petal::Hash::String::TOKEN_RE; my @vars = $text =~ /$token_re/gsm; my %vars = map { $_ => 1 } @vars; @vars = sort { length ($b) <=> length ($a) } keys %vars; foreach my $var (@vars) { my $command = $var; $command =~ s/^\$//; $command =~ s/^\{//; $command =~ s/\}$//; $command = $class->_encode_backslash_semicolon ($command); $command = ""; $text =~ s/\Q$var\E/$command/g; } $att->{$key} = $text; } $class->_attributes ($tag, $att); my @att_str = (); foreach my $key (keys %{$att}) { next if ($key =~ /^$petal:/); my $value = $att->{$key}; if ($value =~ /^<\?attr/) { push @att_str, $value; } else { my $tokens = Petal::CodeGenerator->_tokenize (\$value); my @res = map { ($_ =~ /$Petal::CodeGenerator::PI_RE/s) ? $_ : do { $_ =~ s/\&/&/g; $_ =~ s/\/>/g; $_ =~ s/\"/"/g; $_; }; } @{$tokens}; push @att_str, $key . '="' . (join '', @res) . '"'; } } my $att_str = join " ", @att_str; if ( (uc ($tag) eq 'AREA') or (uc ($tag) eq 'BASE') or (uc ($tag) eq 'BASEFONT') or (uc ($tag) eq 'BR') or (uc ($tag) eq 'COL') or (uc ($tag) eq 'FRAME') or (uc ($tag) eq 'HR') or (uc ($tag) eq 'IMG') or (uc ($tag) eq 'INPUT') or (uc ($tag) eq 'ISINDEX') or (uc ($tag) eq 'LINK') or (uc ($tag) eq 'META') or (uc ($tag) eq 'PARAM') ) { if (defined $att->{"$petal:omit-tag"}) { my $expression = $att->{"$petal:omit-tag"} || 'string:1'; $Petal::Canonicalizer::XML::NodeStack[$#Petal::Canonicalizer::XML::NodeStack]->{'omit-tag'} = $expression; push @Petal::Canonicalizer::XML::Result, (defined $att_str and $att_str) ? "<$tag $att_str />" : "<$tag />"; } else { push @Petal::Canonicalizer::XML::Result, (defined $att_str and $att_str) ? "<$tag $att_str />" : "<$tag />"; } } else { if (defined $att->{"$petal:omit-tag"}) { my $expression = $att->{"$petal:omit-tag"} || 'string:1'; $Petal::Canonicalizer::XML::NodeStack[$#Petal::Canonicalizer::XML::NodeStack]->{'omit-tag'} = $expression; push @Petal::Canonicalizer::XML::Result, (defined $att_str and $att_str) ? "<$tag $att_str>" : "<$tag>"; } else { push @Petal::Canonicalizer::XML::Result, (defined $att_str and $att_str) ? "<$tag $att_str>" : "<$tag>"; } } $class->_content ($tag, $att); } } # $class->EndTag(); # ----------------- # Called for every end tag with a second parameter of the element type. # It will check in the @Petal::Canonicalizer::XML::NodeStack to see if this end-tag also needs to close # some 'condition' or 'repeat' statements, i.e. # #
  • # # Could be rewritten # # # # If the starting LI used a loop, i.e.
  • sub EndTag { my $class = shift; return if ($class->_is_inside_content_or_replace ( 'endtag' )); my ($tag) = $_ =~ /^<\/\s*((?:\w|\:|\-)*)/; my $node = pop (@Petal::Canonicalizer::XML::NodeStack); return if ($class->_is_xinclude ($tag)); if ( (not (defined $node->{replace} and $node->{replace})) and (uc ($tag) ne 'AREA') and (uc ($tag) ne 'BASE') and (uc ($tag) ne 'BASEFONT') and (uc ($tag) ne 'BR') and (uc ($tag) ne 'COL') and (uc ($tag) ne 'FRAME') and (uc ($tag) ne 'HR') and (uc ($tag) ne 'IMG') and (uc ($tag) ne 'INPUT') and (uc ($tag) ne 'ISINDEX') and (uc ($tag) ne 'LINK') and (uc ($tag) ne 'META') and (uc ($tag) ne 'PARAM') ) { if (defined $node->{'omit-tag'}) { my $expression = $node->{'omit-tag'}; push @Petal::Canonicalizer::XML::Result, ""; } else { push @Petal::Canonicalizer::XML::Result, ""; } } my $repeat = $node->{repeat} || '0'; my $condition = $node->{condition} || '0'; my $define_slot = $node->{define_slot} || '0'; push @Petal::Canonicalizer::XML::Result, map { '' } 1 .. ($repeat+$condition+$define_slot); if (exists $node->{'on-error'}) { my $expression = $node->{'on-error'}; push @Petal::Canonicalizer::XML::Result, ""; } } 1; Petal-2.25/lib/Petal/PaxHeaders.604/Entities.pm0000644000000000000000000000007311714720667016051 xustar0029 atime=1398329059.83246357 30 ctime=1550088055.149412525 Petal-2.25/lib/Petal/Entities.pm0000644000175000001440000002014011714720667016624 0ustar00nineusers00000000000000# Entirely stolen from HTML::Entities # And modified to fit Petal's purposes. package Petal::Entities; use strict; use warnings; our %ENTITY_2_CHAR = ( # Some normal chars that have special meaning in SGML context # those will be managed by XML::Parser # so we don't want to expand them # amp => '&', # ampersand # 'gt' => '>', # greater than # 'lt' => '<', # less than # quot => '"', # double quote # apos => "'", # single quote # PUBLIC ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML AElig => 'Æ', # capital AE diphthong (ligature) Aacute => 'Á', # capital A, acute accent Acirc => 'Â', # capital A, circumflex accent Agrave => 'À', # capital A, grave accent Aring => 'Å', # capital A, ring Atilde => 'Ã', # capital A, tilde Auml => 'Ä', # capital A, dieresis or umlaut mark Ccedil => 'Ç', # capital C, cedilla ETH => 'Ð', # capital Eth, Icelandic Eacute => 'É', # capital E, acute accent Ecirc => 'Ê', # capital E, circumflex accent Egrave => 'È', # capital E, grave accent Euml => 'Ë', # capital E, dieresis or umlaut mark Iacute => 'Í', # capital I, acute accent Icirc => 'Î', # capital I, circumflex accent Igrave => 'Ì', # capital I, grave accent Iuml => 'Ï', # capital I, dieresis or umlaut mark Ntilde => 'Ñ', # capital N, tilde Oacute => 'Ó', # capital O, acute accent Ocirc => 'Ô', # capital O, circumflex accent Ograve => 'Ò', # capital O, grave accent Oslash => 'Ø', # capital O, slash Otilde => 'Õ', # capital O, tilde Ouml => 'Ö', # capital O, dieresis or umlaut mark THORN => 'Þ', # capital THORN, Icelandic Uacute => 'Ú', # capital U, acute accent Ucirc => 'Û', # capital U, circumflex accent Ugrave => 'Ù', # capital U, grave accent Uuml => 'Ü', # capital U, dieresis or umlaut mark Yacute => 'Ý', # capital Y, acute accent aacute => 'á', # small a, acute accent acirc => 'â', # small a, circumflex accent aelig => 'æ', # small ae diphthong (ligature) agrave => 'à', # small a, grave accent aring => 'å', # small a, ring atilde => 'ã', # small a, tilde auml => 'ä', # small a, dieresis or umlaut mark ccedil => 'ç', # small c, cedilla eacute => 'é', # small e, acute accent ecirc => 'ê', # small e, circumflex accent egrave => 'è', # small e, grave accent eth => 'ð', # small eth, Icelandic euml => 'ë', # small e, dieresis or umlaut mark iacute => 'í', # small i, acute accent icirc => 'î', # small i, circumflex accent igrave => 'ì', # small i, grave accent iuml => 'ï', # small i, dieresis or umlaut mark ntilde => 'ñ', # small n, tilde oacute => 'ó', # small o, acute accent ocirc => 'ô', # small o, circumflex accent ograve => 'ò', # small o, grave accent oslash => 'ø', # small o, slash otilde => 'õ', # small o, tilde ouml => 'ö', # small o, dieresis or umlaut mark szlig => 'ß', # small sharp s, German (sz ligature) thorn => 'þ', # small thorn, Icelandic uacute => 'ú', # small u, acute accent ucirc => 'û', # small u, circumflex accent ugrave => 'ù', # small u, grave accent uuml => 'ü', # small u, dieresis or umlaut mark yacute => 'ý', # small y, acute accent yuml => 'ÿ', # small y, dieresis or umlaut mark # Some extra Latin 1 chars that are listed in the HTML3.2 draft (21-May-96) copy => '©', # copyright sign reg => '®', # registered sign nbsp => "\240", # non breaking space # Additional ISO-8859/1 entities listed in rfc1866 (section 14) iexcl => '¡', cent => '¢', pound => '£', curren => '¤', yen => '¥', brvbar => '¦', sect => '§', uml => '¨', ordf => 'ª', laquo => '«', 'not' => '¬', # not is a keyword in perl shy => '­', macr => '¯', deg => '°', plusmn => '±', sup1 => '¹', sup2 => '²', sup3 => '³', acute => '´', micro => 'µ', para => '¶', middot => '·', cedil => '¸', ordm => 'º', raquo => '»', frac14 => '¼', frac12 => '½', frac34 => '¾', iquest => '¿', 'times' => '×', # times is a keyword in perl divide => '÷', ( $] > 5.007 ? ( OElig => chr(338), oelig => chr(339), Scaron => chr(352), scaron => chr(353), Yuml => chr(376), fnof => chr(402), circ => chr(710), tilde => chr(732), Alpha => chr(913), Beta => chr(914), Gamma => chr(915), Delta => chr(916), Epsilon => chr(917), Zeta => chr(918), Eta => chr(919), Theta => chr(920), Iota => chr(921), Kappa => chr(922), Lambda => chr(923), Mu => chr(924), Nu => chr(925), Xi => chr(926), Omicron => chr(927), Pi => chr(928), Rho => chr(929), Sigma => chr(931), Tau => chr(932), Upsilon => chr(933), Phi => chr(934), Chi => chr(935), Psi => chr(936), Omega => chr(937), alpha => chr(945), beta => chr(946), gamma => chr(947), delta => chr(948), epsilon => chr(949), zeta => chr(950), eta => chr(951), theta => chr(952), iota => chr(953), kappa => chr(954), lambda => chr(955), mu => chr(956), nu => chr(957), xi => chr(958), omicron => chr(959), pi => chr(960), rho => chr(961), sigmaf => chr(962), sigma => chr(963), tau => chr(964), upsilon => chr(965), phi => chr(966), chi => chr(967), psi => chr(968), omega => chr(969), thetasym => chr(977), upsih => chr(978), piv => chr(982), ensp => chr(8194), emsp => chr(8195), thinsp => chr(8201), zwnj => chr(8204), zwj => chr(8205), lrm => chr(8206), rlm => chr(8207), ndash => chr(8211), mdash => chr(8212), lsquo => chr(8216), rsquo => chr(8217), sbquo => chr(8218), ldquo => chr(8220), rdquo => chr(8221), bdquo => chr(8222), dagger => chr(8224), Dagger => chr(8225), bull => chr(8226), hellip => chr(8230), permil => chr(8240), prime => chr(8242), Prime => chr(8243), lsaquo => chr(8249), rsaquo => chr(8250), oline => chr(8254), frasl => chr(8260), euro => chr(8364), image => chr(8465), weierp => chr(8472), real => chr(8476), trade => chr(8482), alefsym => chr(8501), larr => chr(8592), uarr => chr(8593), rarr => chr(8594), darr => chr(8595), harr => chr(8596), crarr => chr(8629), lArr => chr(8656), uArr => chr(8657), rArr => chr(8658), dArr => chr(8659), hArr => chr(8660), forall => chr(8704), part => chr(8706), exist => chr(8707), empty => chr(8709), nabla => chr(8711), isin => chr(8712), notin => chr(8713), ni => chr(8715), prod => chr(8719), sum => chr(8721), minus => chr(8722), lowast => chr(8727), radic => chr(8730), prop => chr(8733), infin => chr(8734), ang => chr(8736), 'and' => chr(8743), 'or' => chr(8744), cap => chr(8745), cup => chr(8746), 'int' => chr(8747), there4 => chr(8756), sim => chr(8764), cong => chr(8773), asymp => chr(8776), 'ne' => chr(8800), equiv => chr(8801), 'le' => chr(8804), 'ge' => chr(8805), 'sub' => chr(8834), sup => chr(8835), nsub => chr(8836), sube => chr(8838), supe => chr(8839), oplus => chr(8853), otimes => chr(8855), perp => chr(8869), sdot => chr(8901), lceil => chr(8968), rceil => chr(8969), lfloor => chr(8970), rfloor => chr(8971), lang => chr(9001), rang => chr(9002), loz => chr(9674), spades => chr(9824), clubs => chr(9827), hearts => chr(9829), diams => chr(9830), ) : ()) ); my %subst; # compiled encoding regexps sub decode_entities { my $array = \@_; # modify in-place my $c; for (@$array) { s/(&\#(\d+);?)/$2 < 256 ? chr($2) : $1/eg; s/(&\#[xX]([0-9a-fA-F]+);?)/$c = hex($2); $c < 256 ? chr($c) : $1/eg; s/(&(\w+);?)/$ENTITY_2_CHAR{$2} || $1/eg; } wantarray ? @$array : $array->[0]; } 1; Petal-2.25/lib/Petal/PaxHeaders.604/Cookbook.pod0000644000000000000000000000007311714720667016201 xustar0029 atime=1398329059.82846357 30 ctime=1550088055.149412525 Petal-2.25/lib/Petal/Cookbook.pod0000644000175000001440000003124611714720667016765 0ustar00nineusers00000000000000=head1 NAME Petal::Cookbook - Recipes for building templates with Petal =head1 DESCRIPTION This document contains some examples of L template usage. Most of these examples deal with using Petal to generate HTML files from HTML templates. =head1 BASICS =head2 Template location When using Petal for web application development, your templates should not need to be accessible by the webserver. In fact, it could be a security risk if they are available since there may be code or comments which users should not see prior to processing by Petal. Thus, it is recommended to store your templates in a non-web accessible directory. Personally I prefer to place the directory outside of the web root but you could also use permissions or .htaccess files to control access to the directory. This directory path should go into the $Petal::BASE_DIR global setting or the 'base_dir' argument for the new() constructor. =head2 Template naming Petal is indifferent about the name of the template files. Personally, I like to name my templates with the .tmpl extension to help myself and designers distinguish templates from static html. Some GUI editors, though, will not open files without a htm/html extension (esp. under Windows). =head2 Fixing invalid templates (Is this XML well-formed?) If you are getting a parse_error when trying to process your template, you will need to clean up your XHTML template in order for Petal to process it. Two tools will be of great assistance in taking the step towards better standards compliance--HTML Tidy (L) and xmllint. In addition, you can use the page validation services at W3C (L). Alternatively, you could use the L module which will parse non well-formed HTML documents using L. HTML Tidy will rewrite your document into valid XHTML and, if requested, even replace legacy formatting tags with their CSS counterparts. You can safely ignore the warnings about proprietary attributes. Be sure to read the output of what HTML Tidy is doing or else you may find it removing important tags which it thinks are empty or invalid (e.g., inline elements outside of a block). One of the important options that should be set is output_xhtml (-asxhtml from the command-line). Here's an example of how to use it (see the documentation for complete details): tidy --asxhtml original_file.html > new_file.html Once your document is well-formed, you can use xmllint to do day-to-day checking that it stays well-formed without having to wade through the warnings that HTML Tidy will generate about proprietary attributes. The following command will check that a document is well-formed: xmllint --noout To prevent errors about undefined namespace prefix, be sure to include these in your template like so: You may receive errors from xmllint about unknown entities such as  . These can be safely ignored, though you can use the numeric version   instead to keep xmllint happy. If you find a way to suppress these warnings, please let us know. In the meantime, you can pass the output through grep to ignore these bogus warnings:. xmllint --noout tmpl/contact_info.tmpl >& grep -v 'Entity' Now you have no excuse for not creating well-formed XHTML documents. =head2 Passing a hashreference to Petal::process An effective way to collate data to send to the Petal process command is via a hash reference. Used as follows, this technique allows you to build up your data to be passed to the template slowly: my $hash = { string => 'Three', 'number' => 3 }; $hash->{'foo'} = "bar"; my $template = new Petal ( 'test.tmpl' ); my $html = $template->process($hash); # Output the results print "Content-type: text/html\n\n"; print $html; =head2 Basic loops with tal:repeat One way to use tal:repeat is to create an a reference to an array of anonymous hashes. Here is an example: my $array_ref= [ { firstname=>"David", surname=>"Lloyd" }, { firstname=>"Susan", surname=>"Jones" } ]; With this array you can use the tal:repeat structure. Let's say you have this template - this is a snippet so don't forget the proper name space declarations and such:
    First Name Last Name
    First Name Last Name
    If you processed that template and the method call "list_of_names" returned an array reference as described above, you'd get:
    First Name Last Name
    David Lloyd
    Susan Jones
    So, in a tal:repeat construct: tal:repeat="tal_variable_name EXPRESSION" tal_variable_name is the name of the variable you use in your tal template to refer to each row of data you are looping through. EXPRESSION should return an array reference, where each row is an anonymous hash, array, scalar or object. You can then refer to the members of the anonymous hash like this: "$tal_variable_name/key_from_hash" =head1 INTERMEDIATE TIPS =head2 Assigning attributes (submitted by Warren Smith) Up until now, if I wanted to use petal to pre-select an item in a selectbox, I would have to do each item twice, like so: $VAR1 = [ { value => 1, label => 'Option 1', selected => 1 }, { value => 2, label => 'Option 2', selected => 0 }, { value => 4, label => 'Option 3', selected => 0 }, ]; After reading the Petal source, I found that if you use petal:attributes to assign an attribute an undefined value, the attribute gets omitted, thus the above code can be replaced with the simpler version below: $VAR1 = [ { value => 1, label => 'Option 1', selected => 1 }, { value => 2, label => 'Option 2' }, { value => 4, label => 'Option 3' }, ]; It turns out that although not documented in Petal's documentation, this behavior is part of the TAL specification: http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL Thanks to Fergal Daly for his knowledge of the TAL specification. =head2 Generating even/odd rows (submitted by Warren Smith) I developed a decode: modifier that works similar to Oracle's decode statement. It provides an if/then/else construct and is part of the L collection of modifiers. Using decode, it is possible to make even/odd rows of a table different classes, which allows you to do things like alter color, font-size, etc, is relatively easy. Example: ...
    Employee Name
    See L for more information. Alternatively, this can be done entirely with TAL (contributed by Jonathan Vanasco):
    This will use either the rowEven or rowOdd class. All of the 'tag' elements are omitted on render. This uses a nested define tag in a condition tag, because define precedes condition in order of operations.
    The simplest way to do odd/even rows may to duplicate the code entirely for each type or row, though this may cause maintenance headaches: ...
    Employee Name Employee Name
    =head1 ADVANCED =head2 Invoking methods on objects Petal supports the ability to call an object's methods if passed in to Petal::process via the %hash. Say you wish to check whether a particular record is contained in a recordset returned from an SQL query. Using OO-Perl techniques, you could use the following technique as described by Jean-Michel: =over 4 =item * all your records are hashrefs which come from some database =item * you have a list of them to display =back Let's say that the database table looks like this: Raters (id, first_name, last_name, relation, phone, email) You could bless each record into a package as is: use MyApplication::Record::Rater; my @records = complicated_query_somewhere_else(); bless $_, "MyApplication::Record::Rater" for (@records); $hash->{'records'} = \@records; Your module could look like that: package MyApplication::Record::Rater; use strict; use warnings; use CGI; use Carp; sub is_current_id { my $self = shift; my $cgi = CGI->new; my $id = $cgi->param ('rater.id'); return unless (defined $id and $id and $id =~ /^\d+$/); return $id == $self->{id}; } 1; Then on top of your existing data, you have a method which you can call from Petal, i.e.
    • Current id
    This trick can also be used when you have foreign keys in database fields. For example, let's imagine that you have a column called 'friend_id'. It references another 'rater' which is supposed to be a friend of that person. You could define the following subroutine: # give me the friend record for that person sub friend { my $self = shift; my $friend_id = $self->{friend_id}; my $sql = 'select * from rater where id = ?'; my $sth = $::DBH_CONNECTION->prepare_cached ($sql); $sth->execute ($friend_id); my $hash = $sth->fetchrow_hashref; return unless (defined $hash); bless $hash, "MyApplication::Record::Rater"; return $hash; } Then in your template, you could do:
    Your friend is: First Last
    Thanks to Jean-Michel Hiver for this tip. If you are doing a lot of database manipulation via Petal, you probably should consider an object-relational mapping library . Personally, I recommend L. There is a list of many of these tools at Perl Object Oriented Persistence (L). =head2 Using CGI.pm to build forms Calling the HTML generating methods of CGI.pm from the Petal template provides an extremely simple means to develop forms. For example, the ususal ratnest of loops used to populate a checkbox group can be replaced by the simple and elegant construct below. You can put in a dummy checkbox to give the HTML designer something to look at. Be sure to call CGI with the -compile option as follows: use CGI qw(-compile [:all]); $hash->{'query'} = new CGI; $hash->{'choices'} = [1, 2, 3, 4]; Test Thanks to Kurt Stephens for this tip. =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. All code examples in these files are hereby placed into the public domain. You are permitted and encouraged to use this code in your own programs for fun or for profit as you see fit. A simple comment in the code giving credit would be courteous but is not required. =head1 AUTHOR William McKee . Thanks to the following contributors: Jean-Michel Hiver, Kurt Stephens, Warren Smith, Fergal Daly. =head1 SEE ALSO L, L, the test file t/084_Cookbook.t and the test template t/data/cookbook.html. =cut Petal-2.25/lib/Petal/PaxHeaders.604/Deprecated.pod0000644000000000000000000000007311714720667016473 xustar0029 atime=1398329059.82846357 30 ctime=1550088055.149412525 Petal-2.25/lib/Petal/Deprecated.pod0000644000175000001440000001665211714720667017263 0ustar00nineusers00000000000000=head1 NAME Petal::Deprecated - Documents Petal's deprecated syntax. =head1 IMPORTANT NOTE This is an article, not a module. From version 2.00 onwards Petal *requires* that you use well-formed XML. This is because Petal now uses L rather than L and L. In particular, this version of Petal *CAN* break backwards compatibility if you were using Petal's HTML mode will non well formed XHTML. If you still want to use broken XHTML, you can Petal 2.00 in conjunction with L which has been created for this purpose. =head1 INLINE VARIABLES SYNTAX This is the variable 'my_var' : ${my_var}. And if C contained I, Petal would have outputted: This is the variable 'my_var' : Hello World. Now let's say that C is a hash reference as follows: $VAR1 = { hello_world => 'Hello, World' } To output the same result, you would write: This is the variable 'my_var' : ${my_var/hello_world}. =head1 SETTING PETAL OPTIONS AS GLOBALS If you want to use an option throughout your entire program and don't want to have to pass it to the constructor each time, you can set them globally. They will then act as defaults unless you override them in the constructor. $Petal::BASE_DIR (use base_dir option) $Petal::INPUT (use input option) $Petal::OUTPUT (use output option) $Petal::TAINT (use taint option) $Petal::ERROR_ON_UNDEF_VAR (use error_on_undef_var option) $Petal::DISK_CACHE (use disk_cache option) $Petal::MEMORY_CACHE (use memory_cache option) $Petal::MAX_INCLUDES (use max_includes option) $Petal::LANGUAGE (use default_language option) $Petal::DEBUG_DUMP (use debug_dump option) # $Petal::ENCODE_CHARSET (use encode_charset option) -- _DEPRECATED_ $Petal::DECODE_CHARSET (use decode_charset option) =head1 TAL DIRECTIVES ALIASES On top of all that, for people who are lazy at typing the following aliases are provided (although I would recommend sticking to the defaults): * tal:define - tal:def, tal:set * tal:condition - tal:if * tal:repeat - tal:for, tal:loop, tal:foreach * tal:attributes - tal:att, tal:attr, tal:atts * tal:content - tal:inner * tal:replace - tal:outer TRAP: Don't forget that the default prefix is C NOT C, until you set the petal namespace in your HTML or XML document as follows: =head1 XINCLUDES Let's say that your base directory is C, and you're editing C. From there you want to include C =head2 general syntax You can use a subset of the XInclude syntax as follows: For backwards compatibility reasons, you can omit the first slash, i.e. =head2 relative paths If you'd rather use a path which is relative to the template itself rather than the base directory, you can do it but the path MUST start with a dot, i.e. etc. =head2 limitations The C parameter does not support URIs, no other tag than C is supported, and no other directive than the C parameter is supported at the moment. Also note that contrarily to the XInclude specification Petal DOES allow recursive includes up to C<$Petal::MAX_INCLUDES>. This behavior is very useful when templating structures which fit well recursive processing such as trees, nested lists, etc. You can ONLY use the following Petal directives with Xinclude tags: * on-error * define * condition * repeat C, C, C and C are NOT supported in conjunction with XIncludes. =head1 UGLY SYNTAX For certain things which are not doable using TAL you can use what I call the UGLY SYNTAX. The UGLY SYNTAX is UGLY, but it can be handy in some cases. For example consider that you have a list of strings: $my_var = [ 'Foo', 'Bar', 'Baz' ]; $template->process (my_var => $my_var, buz => $buz); And you want to display: Hello : Foo : Bar : Baz Which is not doable with TAL without making the XHTML invalid. With the UGLY SYNTAX you can do: Hello<?for name="string my_var"?> : <?var name="string"?><?end?> Of course you can freely mix the UGLY SYNTAX with other Petal syntaxes. So: <?for name="string my_var"?> $string <?end?> Mind you, if you've managed to read the doc this far I must confess that writing:

    $string

    instead of:

    Dummy

    is UGLY too. I would recommend to stick with TAL wherever you can. But let's not disgress too much. =head2 variables Abstract Example <?var name="document/title"?> Why? Because if you don't have things which are replaced by real values in your template, it's probably a static page, not a template... :) =head2 if / else constructs Usual stuff: Happy Birthday, $user/real_name! What?! It's not your birthday? A very merry unbirthday to you! You can use C instead of C, and indeed you can use modifiers: What?! It's not your birthday? A very merry unbirthday to you! Happy Birthday, $user/real_name! Not much else to say! =head2 loops Use either C, C, C or C. They're all the same thing, which one you use is a matter of taste. Again no surprise:

    Listing of user logins

    • :
    Variables are scoped inside loops so you don't risk to erase an existing C variable which would be outside the loop. The template engine also provides the following variables for you inside the loop: - iteration number, starting at 0 - iteration number, starting at 1 - is it the first iteration? - is it the last iteration? - is it not the first and not the last iteration? - is the count even? - is the count odd? Again these variables are scoped, you can safely nest loops, ifs etc... as much as you like and everything should be fine. =head2 Includes It will include the file 'include.xml', using the current C<@Petal::BASE_DIR> directory list. If you want use XML::Parser to include files, you should make sure that the included files are valid XML themselves... FYI XML::Parser chokes on this:

    foo

    bar

    But this works:

    foo

    bar

    (Having only one top element is part of the XML spec). =cut Petal-2.25/lib/Petal/PaxHeaders.604/Hash0000644000000000000000000000013213431073567014527 xustar0030 mtime=1550088055.153412537 30 atime=1550088055.153412537 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Hash/0000755000175000001440000000000013431073567015366 5ustar00nineusers00000000000000Petal-2.25/lib/Petal/Hash/PaxHeaders.604/Var.pm0000644000000000000000000000007311714720667015700 xustar0029 atime=1398329059.85246357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Hash/Var.pm0000644000175000001440000000775011714720667016467 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Hash::Var - Evaluates an expression and returns the result. # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # This module is redistributed under the same license as Perl # itself. # ------------------------------------------------------------------ package Petal::Hash::Var; use strict; use warnings; use Carp; use Scalar::Util qw( blessed reftype ); our $STRING_RE_DOUBLE = qr/(?fetch ($arg); } } else { $arg =~ s/$BEGIN_QUOTE_RE//; $arg =~ s/$END_QUOTE_RE//; $arg =~ s/$ESCAPED_CHAR_RE/$1/gsm; $args[$i] = $arg; } } my $current = $hash; my $current_path = ''; while (@path) { my $next = shift (@path); $next = ($next =~ /:/) ? $hash->fetch ($next) : $next; my $has_path_tokens = scalar @path; my $has_args = scalar @args; if (blessed $current) { ACCESS_OBJECT: goto ACCESS_HASH if ($current->isa('Petal::Hash')); if ($current->can ($next) or $current->can ('AUTOLOAD')) { if ($has_path_tokens) { $current = $current->$next () } else { $current = $current->$next (@args) } } else { goto ACCESS_HASH if ((reftype($current) or '') eq 'HASH'); goto ACCESS_ARRAY if ((reftype($current) or '') eq 'ARRAY'); confess "Cannot invoke '$next' on '" . ref($current) . "' object at '$current_path' - no such method (near $argument)"; } } elsif (ref($current) eq 'HASH') { ACCESS_HASH: unless (ref($current->{$next}) eq 'CODE') { confess "Cannot access hash at '$current_path' with parameters (near $argument)" if ($has_args and not $has_path_tokens); } $current = $current->{$next}; } elsif (ref($current) eq 'ARRAY') { ACCESS_ARRAY: # it might be an array, then the key has to be numerical... confess "Cannot access array at '$current_path' with non-integer index '$next' (near $argument)" unless ($next =~ /$INTEGER_KEY_RE/); confess "Cannot access array at '$current_path' with parameters (near $argument)" if ($has_args and not $has_path_tokens); $current = $current->[$next]; } else { # ... or we cannot find the next value if ($Petal::ERROR_ON_UNDEF_VAR) { # let's croak and return my $warnstr = "Cannot find value for '$next' at '$current_path': $next cannot be retrieved\n"; $warnstr .= "(current value was "; $warnstr .= (defined $current) ? "'$current'" : 'undef'; $warnstr .= ", near $argument)"; confess $warnstr; } return ''; } $current = (ref($current) eq 'CODE') ? $current->(@args) : $current; $current_path .= "/$next"; } # return '' unless (defined $current); # $current = "$current" if (defined $current); return $$current if ref($current) eq 'SCALAR'; return $current; } 1; Petal-2.25/lib/Petal/Hash/PaxHeaders.604/String.pm0000644000000000000000000000007311714720667016416 xustar0029 atime=1398329059.85246357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Hash/String.pm0000644000175000001440000000335411714720667017201 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Hash::String - Interpolates variables with other strings # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # This module is redistributed under the same license as Perl # itself. # ------------------------------------------------------------------ package Petal::Hash::String; use strict; use warnings; use Carp; our $VARIABLE_RE_SIMPLE = qq |\\\$[A-Za-z_][A-Za-z0-9_\\.:\/]+|; our $VARIABLE_RE_BRACKETS = qq |\\\$(?maketext ($argument) } || $argument; $@ and warn $@; }; my $tokens = $self->_tokenize (\$argument); my @res = map { ($_ =~ /$TOKEN_RE/gsm) ? do { s/^\$//; s/^\{//; s/\}$//; $hash->fetch ($_); } : do { s/\\(.)/$1/gsm; $_; }; } @{$tokens}; return join '', map { defined $_ ? $_ : () } @res; } # $class->_tokenize ($data_ref); # ------------------------------ # Returns the data to process as a list of tokens: # ( 'some text', '<% a_tag %>', 'some more text', '<% end-a_tag %>' etc. sub _tokenize { my $self = shift; my $data_ref = shift; my @tokens = $$data_ref =~ /($TOKEN_RE)/gs; my @split = split /$TOKEN_RE/s, $$data_ref; my $tokens = []; while (@split) { push @{$tokens}, shift (@split); push @{$tokens}, shift (@tokens) if (@tokens); } push @{$tokens}, (@tokens); return $tokens; } 1; __END__ Petal-2.25/lib/Petal/Hash/PaxHeaders.604/Test.pm0000644000000000000000000000007311714720667016067 xustar0029 atime=1398329059.85246357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Hash/Test.pm0000644000175000001440000000340411714720667016646 0ustar00nineusers00000000000000=head1 NAME Petal::Hash::Test - Test and Tutorial Petal modifier =head1 SUMMARY Petal modifiers are snippets of code which are used to extend the expression engine capabilities. This test shows how to write your own modifiers. =head1 API The modifier API is very, very simple. It consists of two elements: =head2 The package name Your modifier should be called Petal::Hash::, where is the name that you want to give to your modifier. For example, this modifier is called Petal::Hash::Test. Petal will automatically pick it the module up and assign it the 'test:' prefix. package Petal::Hash::Test; use warnings; use strict; =cut package Petal::Hash::Test; use warnings; use strict; =head2 The method $class->process ($hash, $argument); This class method will define the modifier in itself. * $class is the package name of your modifier (which might come in handy if you're subclassing a modifier), * $hash is the execution context, i.e. the objects and data which will 'fill' your template, * $argument is whatever was after your modifier's prefix. For example, for the expression 'test:foo bar', $argument would be 'foo bar'. In this test / tutorial we're going to write a modifier which uppercases a Petal expression. sub process { my $class = shift; my $hash = shift; my $argument = shift; return uc ($hash->get ($argument)); } 1; __END__ And that's it! Simple! =cut sub process { my $class = shift; my $hash = shift; my $argument = shift; return uc ($hash->get ($argument)); } 1; __END__ =head1 AUTHOR Jean-Michel Hiver This module is redistributed under the same license as Perl itself. =head1 SEE ALSO The template hash module: Petal::Hash =cut Petal-2.25/lib/Petal/PaxHeaders.604/Hash.pm0000644000000000000000000000007311714720667015150 xustar0029 atime=1398329059.83246357 30 ctime=1550088055.153412537 Petal-2.25/lib/Petal/Hash.pm0000644000175000001440000001066011714720667015731 0ustar00nineusers00000000000000package Petal::Hash; use strict; use warnings; use Carp; our $MODIFIERS = {}; # import all plugins once foreach my $include_dir (@INC) { my $dir = "$include_dir/Petal/Hash"; if (-e $dir and -d $dir) { opendir DD, $dir or do { warn "Cannot open directory $dir. Reason: $!"; next; }; my @modules = map { s/\.pm$//; $_ } grep /\.pm$/, grep !/^\./, readdir (DD); closedir DD; foreach my $module (@modules) { $module =~ /^(\w+)$/; $module = $1; eval "use Petal::Hash::$module"; $@ and warn "Cannot import module $module. Reason: $@"; $MODIFIERS->{lc ($module) . ':'} = "Petal::Hash::$module"; } } } # set modifier $MODIFIERS->{'set:'} = sub { my $hash = shift; my $argument = shift; my @split = split /\s+/, $argument; my $set = shift (@split) or confess "bad syntax for 'set:': $argument (\$set)"; my $value = $hash->fetch (join ' ', @split); $hash->{$set} = $value; delete $hash->{__petal_hash_cache__}->{$set}; return ''; }; $MODIFIERS->{'def:'} = $MODIFIERS->{'set:'}; $MODIFIERS->{'define:'} = $MODIFIERS->{'set:'}; # true modifier $MODIFIERS->{'true:'} = sub { my $hash = shift; my $variable = $hash->fetch (@_); return unless (defined $variable); (scalar @{$variable}) ? return 1 : return if (ref $variable eq 'ARRAY' or (ref $variable and $variable =~ /=ARRAY\(/)); ($variable) ? return 1 : return; }; # false modifier $MODIFIERS->{'false:'} = sub { my $hash = shift; my $variable = join ' ', @_; return not $hash->fetch ("true:$variable"); }; $MODIFIERS->{'not:'} = $MODIFIERS->{'false:'}; # encode: modifier (deprecated stuff) $MODIFIERS->{'encode:'} = sub { warn "Petal modifier encode: is deprecated"; my $hash = shift; my $argument = shift; return $hash->fetch ($argument); }; $MODIFIERS->{'xml:'} = $MODIFIERS->{'encode:'}; $MODIFIERS->{'html:'} = $MODIFIERS->{'encode:'}; $MODIFIERS->{'encode_html:'} = $MODIFIERS->{'encode:'}; # Instanciates a new Petal::Hash object which should # be tied to a hash. sub new { my $thing = shift; my $self = (ref $thing) ? bless { %{$thing} }, ref $thing : bless { @_ }, $thing; $self->{__petal_hash_cache__} = {}; return $self; } # Gets a value... sub get { my $self = shift; my $key = shift; my $fresh = $key =~ s/^\s*fresh\s+//; delete $self->{__petal_hash_cache__}->{$key} if ($fresh); exists $self->{__petal_hash_cache__}->{$key} and return $self->{__petal_hash_cache__}->{$key}; my $res = undef; if ($Petal::HTML_ERRORS) { $res = eval { $self->__FETCH ($key) }; $@ and return "[ Cannot fetch $key. ]"; } else { $res = $self->__FETCH ($key); } $self->{__petal_hash_cache__}->{$key} = $res; return $res; } sub get_encoded { my $self = shift; my $key = shift; my $res = $self->get ($key); return unless (defined $res); my $no_encode = $key =~ s/^\s*structure\s+//; unless ($no_encode and $no_encode) { $res =~ s/\&/\&/g; $res =~ s/\{__petal_hash_cache__}}) { /$regex/ and delete $self->{__petal_hash_cache__}->{$_}; } } sub __FETCH { my $self = shift; my $key = shift; my $no_encode = $key =~ s/^\s*structure\s+//; if (defined $no_encode and $no_encode) { return $self->fetch ($key); } else { # can anyone explain why keys beginning with 'text' are not allowed??? $key =~ s/^\s*text\s*//; return $self->fetch ($key); } } # this method fetches a Petal expression and returns it # without XML encoding. FETCH is basically a wrapper around # fetch() which looks for the special keyword 'structure'. sub fetch { my $self = shift; my $key = shift; my $mod = $self->_fetch_mod ($key); $key =~ s/^\Q$mod\E//; $key =~ s/^\s+//; my $module = $MODIFIERS->{$mod} || confess "$mod is not a known modifier"; (defined $module and ref $module and ref $module eq 'CODE') and return $module->($self, $key); $module->process ($self, $key); } sub _fetch_mod { my $self = shift; my $key = shift; my ($mod) = $key =~ /^([A-Za-z0-9_-]+?\:).*/; defined $mod || return 'var:'; return $mod; } 1; __END__ Petal-2.25/lib/Petal/PaxHeaders.604/Functions.pm0000644000000000000000000000007312200721256016217 xustar0029 atime=1398329059.83246357 30 ctime=1550088055.157412549 Petal-2.25/lib/Petal/Functions.pm0000644000175000001440000000435712200721256017006 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::Functions - Helper functions for the Petal.pm wrapper # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: This class parses a template in 'canonical syntax' # (referred as the 'UGLY SYNTAX' in the manual) and generates Perl # code that can be turned into a subroutine using eval(). # ------------------------------------------------------------------ package Petal::Functions; use strict; use warnings; # find_filepath ($filename, @paths); # ---------------------------------- # Finds the filepath for $filename in @paths # and returns it. sub find_filepath { my $filename = shift; for (@_) { s/\/$//; return $_ if (-e "$_/$filename"); } } # find_filename ($language, @paths); # ---------------------------------- # Finds the filename for $language in @paths. # For example, if $language is 'fr-CA' it might return # # fr-CA.html # fr-CA.xml # fr.html # en.html sub find_filename { my $lang = shift; my @paths = @_; while (defined $lang) { foreach my $path (@paths) { my $filename = exists_filename ($lang, $path); defined $filename and return $filename; } $lang = parent_language ($lang); } return; } # parent_language ($lang); # ------------------------ # Returns the parent language for $lang, i.e. # 'fr-CA' => 'fr' => $Petal::LANGUAGE => undef. # # $DEFAULT is set to 'en' by default but that can be changed, e.g. # local $Petal::LANGUAGE = 'fr' for example sub parent_language { my $lang = shift; $lang =~ /-/ and do { ($lang) = $lang =~ /^(.*)\-/; return $lang; }; $lang eq $Petal::LANGUAGE and return; return $Petal::LANGUAGE; } # exists_filename ($language, $path); # ----------------------------------- # looks for a file that matches $langage. in $path # if the file is found, returns the filename WITH its extension. # # example: # # # $filename will be either 'en-US.html, en-US.xml, ... or 'undef'. # my $filename = exists_filename ('en-US', './scratch'); sub exists_filename { my $language = shift; my $path = shift; return (map { s{\Q$path\E/?}{}; $_ } <$path/$language.*>)[0]; } 1; __END__ Petal-2.25/lib/Petal/PaxHeaders.604/I18N.pm0000644000000000000000000000007311714720667014744 xustar0029 atime=1398329059.83646357 30 ctime=1550088055.157412549 Petal-2.25/lib/Petal/I18N.pm0000644000175000001440000002541411714720667015530 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal::I18N - Independant I18N processing # ------------------------------------------------------------------ package Petal::I18N; use MKDoc::XML::TreeBuilder; use MKDoc::XML::TreePrinter; use Petal::Hash::String; use warnings; use strict; our $Namespace = "http://xml.zope.org/namespaces/i18n"; our $Prefix = 'i18n'; our $Domain = 'default'; sub process { my $class = shift; my $data = shift; local $Namespace = $Namespace; local $Prefix = $Prefix; local $Domain = $Domain; my @nodes = MKDoc::XML::TreeBuilder->process_data ($data); for (@nodes) { $class->_process ($_) } return MKDoc::XML::TreePrinter->process (@nodes); } sub _process { my $class = shift; my $tree = shift; return unless (ref $tree); local $Prefix = $Prefix; local $Domain = $Domain; # process the I18N namespace foreach my $key (keys %{$tree}) { my $value = $tree->{$key}; if ($value eq $Namespace) { next unless ($key =~ /^xmlns\:/); delete $tree->{$key}; $Prefix = $key; $Prefix =~ s/^xmlns\://; } } # set the current i18n:domain $Domain = delete $tree->{"$Prefix:domain"} || $Domain; my $tag = $tree->{_tag}; my $attr = { map { /^_/ ? () : ( $_ => $tree->{$_} ) } keys %{$tree} }; return if ($tag eq '~comment' or $tag eq '~pi' or $tag eq '~declaration'); # replace attributes with their respective translations $tree->{"$Prefix:attributes"} && do { my $attributes = $tree->{"$Prefix:attributes"}; $attributes =~ s/\s*;\s*$//; $attributes =~ s/^\s*//; my @attributes = split /\s*\;\s*/, $attributes; foreach my $attribute (@attributes) { # if we have i18n:attributes="alt alt_text", then the # attribute name is 'alt' and the # translate_id is 'alt_text' my ($attribute_name, $translate_id); if ($attribute =~ /\s/) { ($attribute_name, $translate_id) = split /\s+/, $attribute, 2; } # otherwise, if we have i18n:attributes="alt", then the # attribute name is 'alt' and the # translate_id is $tree->{'alt'} else { $attribute_name = $attribute; $translate_id = _canonicalize ( $tree->{$attribute_name} ); } # the default value if maketext() fails should be the current # value of the attribute my $default_value = $tree->{$attribute_name}; # the value to replace the attribute with should be either the # translation, or the default value if maketext() failed. my $value = eval { $Petal::TranslationService->maketext ($translate_id) } || $default_value; # if maketext() failed, let's know why. $@ && warn $@; # set the (hopefully) translated value $tree->{$attribute_name} = $value; } }; # replace content with its translation exists $tree->{"$Prefix:translate"} && do { my ($translate_id); # if we have $Domain:translate="something", # then the translate_id is 'something' if (defined $tree->{"$Prefix:translate"} and $tree->{"$Prefix:translate"} ne '') { $translate_id = $tree->{"$Prefix:translate"}; } # otherwise, the translate_id has to be computed # from the contents of this node, so that #
    Hello, David, how are you?
    # becomes 'Hello, ${user}, how are you?' else { $translate_id = _canonicalize ( _extract_content_string ($tree) ); } # the default value if maketext() fails should be the current # value of the attribute my $default_value = _canonicalize ( _extract_content_string ($tree) ); # the value to replace the content with should be either the # translation, or the default value if maketext() failed. my $value = eval { $Petal::TranslationService->maketext ($translate_id) } || $default_value; # now, $value is supposed to have the translated string, which looks like # 'Bonjour, ${user}, comment allez-vous?'. We need to turn this back into # a tree structure. my %named_nodes = _extract_named_nodes ($tree); my @tokens = @{Petal::Hash::String->_tokenize (\$value)}; my @res = map { ($_ =~ /$Petal::Hash::String::TOKEN_RE/gsm) ? do { s/^\$//; s/^\{//; s/\}$//; $named_nodes{$_}; } : do { s/\\(.)/$1/gsm; $_; }; } @tokens; $tree->{_content} = \@res; }; # I know, I know, the I18N namespace processing is a bit broken... # It should suffice for now. delete $tree->{"$Prefix:attributes"}; delete $tree->{"$Prefix:translate"}; delete $tree->{"$Prefix:name"}; # Do the same i18n thing with child nodes, recursively. # for some reason it always makes me think of roller coasters. # Yeeeeeeee! defined $tree->{_content} and do { for (@{$tree->{_content}}) { $class->_process ($_) } }; } sub _canonicalize { my $string = shift; return '' unless (defined $string); $string =~ s/\s+/ /gsm; $string =~ s/^ //; $string =~ s/ $//; return $string; } sub _extract_named_nodes { my $tree = shift; my @nodes = (); foreach my $node (@{$tree->{_content}}) { ref $node || next; push @nodes, $node; } my %nodes = (); my $count = 0; foreach my $node (@nodes) { $count++; my $name = $node->{"$Prefix:name"} || $count; $nodes{$name} = $node; } return %nodes; } sub _extract_content_string { my $tree = shift; my @res = (); my $count = 0; foreach my $node (@{$tree->{_content}}) { ref $node or do { push @res, $node; next; }; $count++; my $name = $node->{"$Prefix:name"} || $count; push @res, '${' . $name . '}'; } return join '', @res; } 1; __END__ =head1 NAME Petal::I18N - Attempt at implementing ZPT I18N for Petal =head1 SYNOPSIS in your Perl code: use Petal; use Petal::TranslationService::Gettext; my $translation_service = new Petal::TranslationService::Gettext ( locale_dir => '/path/to/my/app/locale', target_lang => gimme_target_lang(), ); my $template = new Petal ( file => 'example.html', translation_service => $translation_service ); # we want to internationalize to the h4x0rz 31337 l4nGu4g3z. w00t! my $translation_service = Petal::TranslationService::h4x0r->new(); my $template = new Petal ( file => 'silly_example.xhtml', translation_service => $ts, ); print $template->process (); =head1 I18N Howto =head2 Preparing your templates: Say your un-internationalized template looks like this: the logo of our organisation

    Hello, Joe.

    How are you today?

    You need to markup your template according to the ZPT I18N specification, which can be found at http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZPTInternationalizationSupport the logo of our organisation

    Hello, Joe.

    How are you today?

    =head2 Extracting I18N strings: Once your templates are marked up properly, you will need to use a tool to extract the I18N strings into .pot (po template) files. To my knowledge you can use i18ndude (standalone python executable), i18nextract.py (part of Zope 3), or L. I use i18ndude to find strings which are not marked up properly with i18n:translate attributes and I18NFool for extracting strings and managing .po files. Assuming you're using i18nfool: mkdir -p /path/to/my/app/locale cd /path/to/my/app/locale i18nfool-extract /path/to/my/template/example.html mkdir en mkdir fr mkdir es i18nfool-update Then you translate the .po files into their respective target languages. When that's done, you type: cd /path/to/my/app/locale i18nfool-build And it builds all the .mo files. =head2 Making your application use a Gettext translation service: Previously you might have had: use Petal; # lotsa code here my $template = Petal->new ('example.html'); This needs to become: use Petal; use Petal::TranslationService::Gettext; # lotsa code here my $template = Petal->new ('example.html'); $template->{translation_service} = Petal::TranslationService::Gettext->new ( locale_dir => '/path/to/my/app/locale', target_lang => gimme_language_code(), ); Where gimme_language_code() returns a language code depending on LC_LANG, content-negotiation, config-file, or whatever mechanism you are using to decide which language is desired. =head2 And then? And then that's it! Your application should be easily internationalizable. There are a few traps / gotchas thought, which are described below. =head1 BUGS, TRAPS, GOTCHAS and other niceties =head2 Translation Phase The translation step takes place ONLY ONCE THE TEMPLATE HAS BEEN PROCESSED. So if you have:

    Hello, Joe

    It most likely will not work because the tal:replace would remove the tag and also the i18n:name in the process. This means that instead of receiving something such as: Hello, ${user_login} The translation service would receive: Hello, Fred Flintstone Or Hello, Joe SixPack etc. To fix this issue, use tal:content instead of tal:replace and leave the span and its i18n:name attribute. =head2 Character sets I haven't worried too much about them (yet) so if you run into trouble join the Petal mailing list and we'll try to fix any issues together. =head2 Limitations At the moment, L supports the following constructs: =over 4 =item xmlns:i18n="http://xml.zope.org/namespaces/i18n" =item i18n:translate =item i18n:domain =item i18n:name =item i18n:attribute =back It does *NOT* (well, not yet) support i18n:source, i18n:target or i18n:data. =cut Petal-2.25/lib/PaxHeaders.604/Petal.pm0000644000000000000000000000013213431073246014251 xustar0030 mtime=1550087846.248753245 30 atime=1550087846.248753245 30 ctime=1550088055.145412511 Petal-2.25/lib/Petal.pm0000644000175000001440000013631713431073246015046 0ustar00nineusers00000000000000# ------------------------------------------------------------------ # Petal - Perl Template Attribute Language # ------------------------------------------------------------------ # Author: Jean-Michel Hiver # Description: Front-end for all Petal templating functionality # ------------------------------------------------------------------ package Petal; use Petal::Hash; use Petal::Cache::Disk; use Petal::Cache::Memory; use Petal::Parser; use Petal::Canonicalizer::XML; use Petal::Canonicalizer::XHTML; use Petal::Functions; use Petal::Entities; use File::Spec; use Carp; use Data::Dumper; use Scalar::Util; use strict; use warnings; use MKDoc::XML::Decode; use Petal::I18N; BEGIN { ($] > 5.007) and do { require Encode; }; $@ and warn $@; } # these are used as local variables when the XML::Parser # is crunching templates... use vars qw /@tokens @nodeStack/; # HTML errors? our $HTML_ERRORS = undef; # Encode / Decode info... our $DECODE_CHARSET = 'utf8'; our $ENCODE_CHARSET = 'utf8'; # deprecated # Prints as much info as possible when this is enabled. our $DEBUG_DUMP = 1; # Warn about uninitialised values in the template? our $WARN_UNINIT = 0; # What do we use to parse input? our $INPUT = 'XML'; our $INPUTS = { 'XML' => 'Petal::Parser', 'HTML' => 'Petal::Parser', 'XHTML' => 'Petal::Parser', }; # What do we use to format output? our $OUTPUT = 'XML'; our $OUTPUTS = { 'XML' => 'Petal::Canonicalizer::XML', 'HTML' => 'Petal::Canonicalizer::XHTML', 'XHTML' => 'Petal::Canonicalizer::XHTML', }; # makes taint mode happy if set to 1 our $TAINT = undef; # don't confess() errors if we access an undefined template variable our $ERROR_ON_UNDEF_VAR = 1; # confess() on include/fill-slot errors our $ERROR_ON_INCLUDE_ERROR = undef; # where are our templates supposed to be? our @BASE_DIR = ('.'); our $BASE_DIR = undef; # for backwards compatibility... # vroom! our $DISK_CACHE = 1; # vroom vroom! our $MEMORY_CACHE = 1; # cache only mode our $CACHE_ONLY = 0; # prevents infinites includes... our $MAX_INCLUDES = 30; our $CURRENT_INCLUDES = 0; # this is for CPAN our $VERSION = '2.25'; # The CodeGenerator class backend to use. # Change this only if you know what you're doing. our $CodeGenerator = 'Petal::CodeGenerator'; our $CodeGeneratorLoaded = 0; # Default language for multi-language mode. # Change if you feel that English isn't a fair default. our $LANGUAGE = 'en'; # this is for XML namespace support. Can't touch this :-) our $NS = 'petal'; our $NS_URI = 'http://purl.org/petal/1.0/'; our $XI_NS = 'xi'; our $XI_NS_URI = 'http://www.w3.org/2001/XInclude'; our $MT_NS = 'metal'; our $MT_NS_URI = 'http://xml.zope.org/namespaces/metal'; our $MT_NAME_CUR = 'main'; # translation service, optional our $TranslationService = undef; # Displays the canonical template for template.xml. # You can set $INPUT using by setting the PETAL_INPUT environment variable. # You can set $OUTPUT using by setting the PETAL_OUTPUT environment variable. sub main::canonical { my $file = shift (@ARGV); local $Petal::DISK_CACHE = 0; local $Petal::MEMORY_CACHE = 0; local $Petal::CACHE_ONLY = 0; local $Petal::INPUT = $ENV{PETAL_INPUT} || 'XML'; local $Petal::OUTPUT = $ENV{PETAL_OUTPUT} || 'XHTML'; print ${Petal->new ($file)->_canonicalize()}; } # Displays the perl code for template.xml. # You can set $INPUT using by setting the PETAL_INPUT environment variable. # You can set $OUTPUT using by setting the PETAL_OUTPUT environment variable. sub main::code { my $file = shift (@ARGV); local $Petal::DISK_CACHE = 0; local $Petal::MEMORY_CACHE = 0; local $Petal::CACHE_ONLY = 0; print Petal->new ($file)->_code_disk_cached; } # Displays the perl code for template.xml, with line numbers. # You can set $INPUT using by setting the PETAL_INPUT environment variable. # You can set $OUTPUT using by setting the PETAL_OUTPUT environment variable. sub main::lcode { my $file = shift (@ARGV); local $Petal::DISK_CACHE = 0; local $Petal::MEMORY_CACHE = 0; local $Petal::CACHE_ONLY = 0; print Petal->new ($file)->_code_with_line_numbers; } sub load_code_generator { if (not $CodeGeneratorLoaded) { eval "require $CodeGenerator"; confess "Failed to load $CodeGenerator, $@" if $@; $CodeGeneratorLoaded = 1; } } # Instanciates a new Petal object. sub new { my $class = shift; $class = ref $class || $class; unshift (@_, 'file') if (@_ == 1); my $self = bless { @_ }, $class; $self->_initialize(); return $self; } # (multi language mode) # if the language has been specified, let's try to # find which template we can use. sub _initialize { my $self = shift; my $file = $self->{file}; if ($file =~ /#/) { my ($file, $macro) = split /#/, $file, 2; $self->{file} = $file; $self->_initialize_lang(); $self->{file} .= "#$macro"; } else { $self->_initialize_lang(); } } sub _initialize_lang { my $self = shift; my $lang = $self->language() || return; my @dirs = $self->base_dir(); @dirs = map { File::Spec->canonpath ("$_/$self->{file}") } @dirs; $self->{file} =~ s/\/$//; my $filename = Petal::Functions::find_filename ($lang, @dirs); $self->{file} .= "/$filename" if ($filename); } # (multi language mode) # returns the current preferred language. sub language { my $self = shift; return $self->{language} || $self->{lang}; } sub default_language { exists $_[0]->{default_language} ? $_[0]->{default_language} : $LANGUAGE } sub input { exists $_[0]->{input} ? $_[0]->{input} : $INPUT } sub output { exists $_[0]->{output} ? $_[0]->{output} : $OUTPUT } sub taint { exists $_[0]->{taint} ? $_[0]->{taint} : $TAINT } sub error_on_undef_var { exists $_[0]->{error_on_undef_var} ? $_[0]->{error_on_undef_var} : $ERROR_ON_UNDEF_VAR } sub disk_cache { exists $_[0]->{disk_cache} ? $_[0]->{disk_cache} : $DISK_CACHE } sub memory_cache { exists $_[0]->{memory_cache} ? $_[0]->{memory_cache} : $MEMORY_CACHE } sub cache_only { exists $_[0]->{cache_only} ? $_[0]->{cache_only} : $CACHE_ONLY } sub max_includes { exists $_[0]->{max_includes} ? $_[0]->{max_includes} : $MAX_INCLUDES } sub base_dir { my $self = shift; return map { defined $_ ? $_ : () } $self->_base_dir(); } sub _base_dir { my $self = shift; if (exists $self->{base_dir}) { my $base_dir = $self->{base_dir}; if (ref $base_dir) { return @{$base_dir} } else { die '\$self->{base_dir} is not defined' unless (defined $base_dir); return $base_dir; } } else { if (defined $BASE_DIR) { return ( $BASE_DIR, @BASE_DIR ) } else { return @BASE_DIR } } } # _include_compute_path ($path); # ------------------------------ # Computes the new absolute path from the current # path and $path sub _include_compute_path { my $self = shift; my $file = shift; # this is for metal self-includes if ($file =~ /^#/) { $file = $self->{file} . $file; } return $file unless ($file =~ /^\./); my $path = $self->{file}; ($path) = $path =~ /(.*)\/.*/; $path ||= '.'; $path .= '/'; $path .= $file; my @path = split /\//, $path; my @new_path = (); while (scalar @path) { my $next = shift (@path); next if $next eq '.'; if ($next eq '..') { die "Cannot go above base directory: $file" if (scalar @new_path == 0); pop (@new_path); next; } push @new_path, $next; } return join '/', @new_path; } # Processes the current template object with the information contained in # %hash. This information can be scalars, hash references, array # references or objects. # # Example: # # my $data_out = $template->process ( # user => $user, # page => $page, # basket => $shopping_basket, # ); # # print "Content-Type: text/html\n\n"; # print $data_out; sub process { my $self = shift; $self->_process_absolutize_pathes(); # ok, from there on we need to override any global variable with stuff # that might have been specified when constructing the object local $TAINT = defined $self->{taint} ? $self->{taint} : $TAINT; local $ERROR_ON_UNDEF_VAR = defined $self->{error_on_undef_var} ? $self->{error_on_undef_var} : $ERROR_ON_UNDEF_VAR; local $DISK_CACHE = defined $self->{disk_cache} ? $self->{disk_cache} : $DISK_CACHE; local $MEMORY_CACHE = defined $self->{memory_cache} ? $self->{memory_cache} : $MEMORY_CACHE; local $CACHE_ONLY = defined $self->{cache_only} ? $self->{cache_only} : $CACHE_ONLY; local $MAX_INCLUDES = defined $self->{max_includes} ? $self->{max_includes} : $MAX_INCLUDES; local $INPUT = defined $self->{input} ? $self->{input} : $INPUT; local $OUTPUT = defined $self->{output} ? $self->{output} : $OUTPUT; local $BASE_DIR = defined $self->{base_dir} ? do { ref $self->{base_dir} ? undef : $self->{base_dir} } : $BASE_DIR; local @BASE_DIR = defined $self->{base_dir} ? do { ref $self->{base_dir} ? @{$self->{base_dir}} : () } : @BASE_DIR; local $LANGUAGE = defined $self->{default_language} ? $self->{default_language} : $LANGUAGE; local $DEBUG_DUMP = defined $self->{debug_dump} ? $self->{debug_dump} : $DEBUG_DUMP; local $ERROR_ON_INCLUDE_ERROR = defined $self->{error_on_include_error} ? $self->{error_on_include_error} : $ERROR_ON_INCLUDE_ERROR; local $DECODE_CHARSET = defined $self->{decode_charset} ? $self->{decode_charset} : $DECODE_CHARSET; local $TranslationService = defined $self->{translation_service} ? $self->{translation_service} : $TranslationService; # local $ENCODE_CHARSET = defined $self->{encode_charset} ? $self->{encode_charset} : $ENCODE_CHARSET; # prevent infinite includes from happening... my $current_includes = $CURRENT_INCLUDES; return "ERROR: MAX_INCLUDES : $CURRENT_INCLUDES" if ($CURRENT_INCLUDES > $MAX_INCLUDES); local $CURRENT_INCLUDES = $current_includes + 1; my $res = undef; eval { my $hash = undef; if (ref $_[0] eq 'Petal::Hash') { $hash = shift } elsif (ref $_[0] eq 'HASH') { $hash = new Petal::Hash (%{shift()}) } else { $hash = new Petal::Hash (@_) } my $coderef = $self->_code_memory_cached; die "\$coderef is undefined\n\n" unless $coderef; die "\$hash is undefined\n\n" unless $hash; $res = $coderef->($hash); }; if ( $CACHE_ONLY == 1 ){ return 1; } if (defined $@ and $@) { $res = $self->_handle_error ($@) } elsif (defined $TranslationService && $CURRENT_INCLUDES == 1) { $res = Petal::I18N->process ($res) } return $res; } # File::Spec->rel2abs() is pretty slow since it uses Cwd which does a # super-ugly backtick. Hence this method absolutizes base directories # only once. It is necessary to work with absolute base directories to # avoid cache conflicts. sub _process_absolutize_pathes { my $self = shift; if (defined $BASE_DIR) { $BASE_DIR = File::Spec->rel2abs ($BASE_DIR) unless ( File::Spec->file_name_is_absolute ($BASE_DIR) ); } @BASE_DIR = ( map { File::Spec->file_name_is_absolute ($_) ? $_ : File::Spec->rel2abs ($_) } map { defined $_ ? $_ : () } @BASE_DIR ); if (defined $self->{base_dir}) { if (ref $self->{base_dir}) { $self->{base_dir} = [ map { File::Spec->file_name_is_absolute ($_) ? $_ : File::Spec->rel2abs ($_) } map { defined $_ ? $_ : () } @{$self->{base_dir}} ] if (defined $self->{base_dir}); } else { $self->{base_dir} = File::Spec->rel2abs ($self->{base_dir}) unless ( File::Spec->file_name_is_absolute ($self->{base_dir}) ); } } } sub _handle_error { my $self = shift; my $error = shift; $Petal::HTML_ERRORS and do { my $res = '
    ';
            $res    .= "Error: $error\n";
            $res    .= "=============\n";
            $res    .= "\n\n";
            $res    .= "Petal object dump:\n";
            $res    .= "==================\n";
    	$res    .= Dumper ($self);
            $res    .= "\n\n";
    	$res    .= "Stack trace:\n";
    	$res    .= "============\n";
    	$res    .= Carp::longmess();
    	$res    .= "\n\n";
            $res    .= "Template perl code dump:\n";
            $res    .= "========================\n";
    
            my $dump = eval { $self->_code_with_line_numbers() };
            $res    .= ($dump) ? $dump : "(no dump available)";
            
            $res .= '
    '; return $res; }; $Petal::DEBUG_DUMP and do { my $tmpdir = File::Spec->tmpdir(); my $tmpfile = $$ . '.' . time() . '.' . ( join '', map { chr (ord ('a') + int (rand (26))) } 1..10 ); my $debug = "$tmpdir/petal_debug.$tmpfile"; open ERROR, ">$debug" || die "Cannot write-open \">$debug\" ($!)"; print ERROR "Error: $error\n"; ref $error and do { print ERROR "=============\n"; }; print ERROR "\n"; print ERROR "Petal object dump:\n"; print ERROR "==================\n"; print ERROR Dumper ($self); print ERROR "\n\n"; print ERROR "Stack trace:\n"; print ERROR "============\n"; print ERROR Carp::longmess(); print ERROR "\n\n"; print ERROR "Template perl code dump:\n"; print ERROR "========================\n"; my $dump = eval { $self->_code_with_line_numbers() }; ($dump) ? print ERROR $dump : print ERROR "(no dump available)"; die "[PETAL ERROR] $error. Debug info written in $debug"; }; ! $Petal::DEBUG_DUMP and do { die "[PETAL ERROR] $error. No debug info written."; }; } # $self->code_with_line_numbers; # ------------------------------ # utility method to return the Perl code, each line being prefixed with # its number... handy for debugging templates. The nifty line number padding # patch was provided by Lucas Saud . sub _code_with_line_numbers { my $self = shift; my $code = $self->_code_disk_cached; # get lines of code my @lines = split(/\n/, $code); # add line numbers my $count = 0; @lines = map { my $cur_line = $_; $count++; # space padding so the line numbers nicely line up with each other my $line_num = sprintf ("%" . length(scalar(@lines)) . "d", $count); # put line number and line back together "${line_num}. ${cur_line}"; } @lines; return join("\n", @lines); } # $self->_file; # ------------- # setter / getter for the 'file' attribute sub _file { my $self = shift; $self->{file} = shift if (@_); $self->{file} =~ s/^\///; return $self->{file}; } sub _macro { my $self = shift; my $file = $self->_file; $file =~ s/^.*#// || return; return $file; } sub _file_path_with_macro { my $self = shift; my $file = $self->_file_path; my $macro = $self->_macro; my $res = $macro ? "$file#$macro" : $file; return $res; } # $self->_file_path; # ------------------ # computes the file of the absolute path where the template # file should be fetched sub _file_path { my $self = shift; my $file = $self->_file; $file =~ s/#.*$//; my @dirs = $self->base_dir; foreach my $dir (@dirs) { # my $base_dir = File::Spec->canonpath ($dir); # $base_dir = File::Spec->rel2abs ($base_dir) unless ($base_dir =~ /^\//); my $base_dir = $dir; $base_dir =~ s/\/$//; my $file_path = File::Spec->canonpath ($base_dir . '/' . $file); return $file_path if (-e $file_path and -r $file_path); } Carp::confess ("Cannot find $file in @dirs. (typo? permission problem?)"); } # $self->_file_data_ref; # ---------------------- # slurps the template data into a variable and returns a # reference to that variable sub _file_data_ref { my $self = shift; my $file_path = $self->_file_path; $file_path =~ s/#.*$//; if ($] > 5.007) { my $encoding = Encode::resolve_alias ($DECODE_CHARSET) || 'utf8'; open FP, "<:encoding($encoding)", "$file_path" or die "Cannot read-open $file_path ($!)"; } else { open FP, "<$file_path" || die "Cannot read-open $file_path ($!)"; } my $res = join '', ; close FP; # kill template comments $res =~ s/\//gsm; my $decode = ($OUTPUT =~ /HTML$/i or $INPUT =~ /HTML$/i) ? new MKDoc::XML::Decode ('numeric', 'xhtml') : new MKDoc::XML::Decode ('numeric'); $res = $decode->process ($res); return \$res; } # $self->_code_disk_cached; # ------------------------- # Returns the Perl code data, using the disk cache if possible sub _code_disk_cached { my $self = shift; my $code = (defined $DISK_CACHE and $DISK_CACHE) ? Petal::Cache::Disk->get ($self->_file_path_with_macro, $self->language) : undef; unless (defined $code) { my $macro = $self->_macro() || $MT_NAME_CUR; local ($MT_NAME_CUR); $MT_NAME_CUR = $macro; my $data_ref = $self->_canonicalize; load_code_generator(); $code = $CodeGenerator->process ($data_ref, $self); Petal::Cache::Disk->set ($self->_file_path_with_macro, $code, $self->language) if (defined $DISK_CACHE and $DISK_CACHE); } return $code; } # $self->_code_memory_cached; # --------------------------- # Returns the Perl code data, using the disk cache if possible sub _code_memory_cached { my $self = shift; my $code = (defined $MEMORY_CACHE and $MEMORY_CACHE) ? Petal::Cache::Memory->get ($self->_file_path_with_macro, $self->language) : undef; unless (defined $code) { my $code_perl = $self->_code_disk_cached; my $VAR1 = undef; eval "$code_perl"; confess ($@ . "\n" . $self->_code_with_line_numbers) if $@; $code = $VAR1; Petal::Cache::Memory->set ($self->_file_path_with_macro, $code, $self->language) if (defined $MEMORY_CACHE and $MEMORY_CACHE); } return $code; } # $self->_code_cache; # ------------------- # Returns TRUE if this object uses the code cache, FALSE otherwise sub _memory_cache { my $self = shift; return $self->{memory_cache} if (defined $self->{memory_cache}); return $MEMORY_CACHE; } # $self->_canonicalize; # --------------------- # Returns the canonical data which will be sent to the # Petal::CodeGenerator module sub _canonicalize { my $self = shift; my $parser_type = $INPUTS->{$INPUT} || confess "unknown \$Petal::INPUT = $INPUT"; my $canonicalizer_type = $OUTPUTS->{$OUTPUT} || confess "unknown \$Petal::OUTPUT = $OUTPUT"; my $data_ref = $self->_file_data_ref; my $parser = $parser_type->new; return $canonicalizer_type->process ($parser, $data_ref); } 1; =head1 NAME Petal - Perl Template Attribute Language - TAL for Perl! =head1 SYNOPSIS in your Perl code: use Petal; my $template = new Petal ('foo.xhtml'); print $template->process (bar => 'BAZ'); in foo.xhtml Dummy Content and you get something like: BAZ =head1 SUMMARY Petal is a XML based templating engine that is able to process any kind of XML, XHTML and HTML. 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. 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. =head1 NAMESPACE Although this is not mandatory, Petal templates should include use the namespace L. Example: Blah blah blah... Content of the file More blah blah... If you do not specify the namespace, Petal will by default try to use the C prefix. However, in all the examples of this POD we'll use the C prefix to avoid too much typing. =head1 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... =head2 Version 1: WYSIWYG friendly prototype. Using TAL you can do: This is the variable 'my_var' : Hola, Mundo! 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. =head2 Version 2: Object-oriented version Let's now say that C is actually an object with a method hello_world() that returns I. To output the same result, your line, which was: Hola, Mundo! 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. 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. =head2 Version 3: Personalizable Now let's say that your method hello_world() can take an optional argument so that C<$some_object-Ehello_world ('Jack')> returns I. You would write: Hola, Mundo! Optionally, you can get rid of the quotes by using two dashes, a la GNU command-line option: Hola, Mundo! So you can pass parameters to methods using double dashes or quotes. Now let us say that your C object also has a method current_user() that returns the current user real name. You can do: Hola, Mundo! TRAP: You cannot write nested expressions such as: ${my_var/hello_world ${my_var/current_user}} This will NOT work. At least, not yet. =head2 Version 4: Internationalized Let's say that you have a directory called C 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 C<$template> object will look in the C directory and try to find a file named C, then C, then will default to C. It works fine for includes, too! These internationalized templates can have whatever file-extension you like, Petal searches on the first part of the filename. So you can call them C, C, C or use whatever convention suits you. NOTE: There is now support for ZPT-like i18n attributes, which should provide a much nicer framework. See L for details. TIP: If you feel that 'en' should not be the default language, you can specify a different default: my $template = new Petal ( file => 'hello_world', language => 'zh', default_language => 'fr' # vive la France! ); TRAP: If you do specify the C option, you MUST use a path to a template directory, not a file directory. Conversely, if you do not specify a C option, you MUST use a path to a template file, not a directory. =head1 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: =head2 file => I The template filename. This option is mandatory and has no default. Note: If you also use 'language' this option should point to a directory. =head2 base_dir => I | [ I ] (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. =head2 input => '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 =head2 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 =head2 language => I For internationalized applications, you can use the 'file' option to point to a I 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'). =head2 default_language => I (default: 'en') This language code will be used if no template matches the selected language-country or language. =head2 taint => I | I (default: I) If set to C, makes perl taint mode happy. =head2 error_on_undef_var => I | I (default: I) If set to C, Petal will confess() errors when trying to access undefined template variables, otherwise an empty string will be returned. =head2 error_on_include_error => I | I (default: I) If set to C, Petal will confess() errors when trying render includes. =head2 disk_cache => I | I (default: I) If set to C, Petal will not use the C module. =head2 memory_cache => I | I (default: I) If set to C, Petal will not use the C module. =head2 cache_only => I | I (default: I) If set to C, 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. =head2 max_includes => I (default: 30) The maximum number of recursive includes before Petal stops processing. This is to guard against accidental infinite recursions. =head2 debug_dump => I | I (default: I) 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 wherever File::Spec->tmpdir() specifies as a temp directory (usually /tmp on a unix system). =head2 encode_charset => I (default: undef) This option is _DEPRECATED_ as of Petal 2.01. Petal will now always return results in Perl's internal form. 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 module L. =head2 decode_charset => I (default: undef) This option will work only if you use Perl 5.8 or greater. If specified, Petal will assume that the template to be processed (and its sub-templates) are in the character set I. I can be any character set that can be used with the module L. =head1 TAL SYNTAX This functionality is directly and shamelessly stolen from the excellent TAL specification: L. =head2 define Abstract Evaluates C and assigns the returned value to C. Example Why? This can be useful if you have a C. You can set it to let's say C and then use C instead of using C. =head2 condition (ifs) Abstract blah blah blah Example Yo, authenticated! Why? Conditions can be used to display something if an expression is true. They can also be used to check that a list exists before attempting to loop through it. =head2 repeat (loops) Abstract blah blah blah Why? Repeat statements are used to loop through a list of values, typically to display the resulting records of a database query. Example:
  • $user/real_name
  • A select list with one item selected: A table with rows of alternating colours set via CSS:
    This a odd row, it comes before the even row.
    This a even row.
    I is a local temporary object that only exists within a petal:repeat loop. It has a bunch of methods useful for selecting different positions in the loop: =head3 repeat/index I returns the numeric position of this item within the loop, starts with one not zero. =head3 repeat/number I is an alias for I. =head3 repeat/even I is true if the position is even (0, 2, 4 ...) =head3 repeat/odd I is true is the position is odd (1, 3, 5 ...) =head3 repeat/start I is true if this is the first item. =head3 repeat/end I is true if this is the last item. =head3 repeat/inner I is true if this is not the I or I. =head2 attributes Abstract blah blah blah Example
    Why? Attributes statements can be used to template a tag's attributes. =head2 content Abstract Dummy Data To Replace With EXPRESSION By default, the characters greater than, lesser than, double quote and ampersand are encoded to the entities I<<>, I<>>, I<"> and I<&> respectively. If you don't want them to (because the result of your expression is already encoded) you have to use the C keyword. Example Dummy Title blah blah blah Why? It lets you replace the contents of a tag with whatever value the evaluation of EXPRESSION returned. This is handy because you can fill your templates with dummy content which will make them usable in a WYSIWYG tool. =head2 replace Abstract This time the entire tag is replaced rather than just the content! Example Dummy Title Why? Similar reasons to C. Note however that C and C are *NOT* aliases. The former will replace the contents of the tag, while the latter will replace the whole tag. Indeed you cannot use C and C in the same tag. =head2 omit-tag Abstract Some contents Example I may not be bold. If C is evaluated as I, then the tag will be omited. If C is evaluated as I, then the tag will stay in place. Why? omit-tag statements can be used to leave the contents of a tag in place while omitting the surrounding start and end tags if the expression which is evaluated is TRUE. TIP: If you want to ALWAYS remove a tag, you can use C =head2 on-error Warning: this is currently only partially implemented. C may be used in Petal templates, but the expression isn't evaluated - Petal simply prints the expression as a string. Abstract ... Example

    $object/method

    Why? When Petal encounters an error, it usually dies with some obscure error message. The C statement lets you trap the error and replace it with a proper error message. =head2 using multiple statements You can do things like:

    Some Dummy Content

    Given the fact that XML attributes are not ordered, withing 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 C NOT C, until you set the petal namespace in your HTML or XML document as follows: =head1 METAL MACROS Petal supports an implementation of the METAL specification, which is a very WYSIWYG compatible way of doing template includes. =head2 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 ============

    (c) Me (r)(tm) (pouet pouet)

    =head2 use-macro In order to use a previously defined macro, you use the metal:use-macro directive. For example: File bar.xml ============ ... plenty of content ...

    Page Footer.

    =head2 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 ============

    (c) Me (r)(tm) (pouet pouet)

    =head2 fill-slot Your including file can override any slot using the fill-slot instruction, i.e. File bar.xml ============ ... plenty of content ...

    Page Footer. (bar baz)

    This would result in the macro 'foo.xml#footer' to produce:

    (c) Me (r)(tm) (bar baz)

    =head2 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. This example templates a sitemap, which on a hierarchically organized site would be recursive by nature:

    Sitemap:

    =head1 EXPRESSIONS AND MODIFIERS Petal has the ability to bind template variables to the following Perl datatypes: scalars, lists, hash, arrays and objects. The article describes the syntax which is used to access these from Petal templates. In the following examples, we'll assume that the template is used as follows: my $hashref = some_complex_data_structure(); my $template = new Petal ('foo.xml'); print $template->process ( $hashref ); Then we will show how the Petal Expression Syntax maps to the Perl way of accessing these values. =head2 accessing scalar values Perl expression $hashref->{'some_value'}; Petal expression some_value Example Hello, World =head2 accessing hashes & arrays Perl expression $hashref->{'some_hash'}->{'a_key'}; Petal expression some_hash/a_key Example Hello, World Perl expression $hashref->{'some_array'}->[12] Petal expression some_array/12 Example Hello, World Note: You're more likely to want to loop through arrays:
    • Hello, World
    =head2 accessing object methods Perl expressions 1. $hashref->{'some_object'}->some_method(); 2. $hashref->{'some_object'}->some_method ('foo', 'bar'); 3. $hashref->{'some_object'}->some_method ($hashref->{'some_variable'}) Petal expressions 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 Note that the syntax as described in 2c works only if you use strings which do not contain spaces. Example

    2 times 2 equals 4

    =head2 composing Petal lets you traverse any data structure, i.e. Perl expression $hashref->{'some_object'} ->some_method() ->{'key2'} ->some_other_method ( 'foo', $hash->{bar} ); Petal expression some_object/some_method/key2/some_other_method --foo bar =head2 true:EXPRESSION If EXPRESSION returns an array reference If this array reference has at least one element Returns TRUE Else Returns FALSE Else If EXPRESSION returns a TRUE value (according to Perl 'trueness') Returns TRUE Else Returns FALSE the C modifiers should always be used when doing Petal conditions. =head2 false:EXPRESSION I'm pretty sure you can work this one out by yourself :-) =head2 set:variable_name EXPRESSION Sets the value returned by the evaluation of EXPRESSION in C<$hash-E{variable_name}>. For instance: Perl expression: $hash->{variable_name} = $hash->{object}->method(); Petal expression: set:variable_name object/method =head2 string:STRING_EXPRESSION The C modifier lets you interpolate petal expressions within a string and returns the value. string:Welcome $user/real_name, it is $date! Alternatively, you could write: string:Welcome ${user/real_name}, it is ${date}! The advantage of using curly brackets is that it lets you interpolate expressions which invoke methods with parameters, i.e. string:The current CGI 'action' param is: ${cgi/param --action} =head1 ADVANCED PETAL =head2 writing your own modifiers Petal lets you write your own modifiers, either using coderefs or modules. =head3 Coderefs Let's say that you want to write an uppercase: modifier, which would uppercase the result of an expression evaluation, as in: uppercase:string:Hello, World Would return HELLO, WORLD Here is what you can do: # don't forget the trailing colon in C !! $Petal::Hash::MODIFIERS->{'uppercase:'} = sub { my $hash = shift; my $args = shift; my $result = $hash->fetch ($args); return uc ($result); }; =head3 Modules. You might want to use a module rather than a coderef. Here is the example above reimplemented 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 is in the namespace Petal::Hash::, Petal will automatically pick it up and assign it to its lowercased name, i.e. in our example C. If your modifier is OUTSIDE Petal::Hash::, you need to make Petal aware of its existence as follows: use MyPetalModifier::UpperCase; $Petal::Hash::MODIFIERS->{'uppercase:'} = 'MyPetalModifier::UpperCase'; =head1 Expression keywords =head3 XML encoding / structure keyword By default Petal will encode C<&>, C<<>, C<>> and C<"> to C<&>, C<<>, C<>> and C<"> respectively. However sometimes you might want to display an expression which is already encoded, in which case you can use the C keyword. structure my/encoded/variable Note that this is a language I, not a modifier. It does not use a trailing colon. =head3 Petal::Hash caching and fresh keyword Petal caches the expressions which it resolves, i.e. if you write the expression: string:$foo/bar, ${baz/buz/blah} Petal::Hash will compute it once, and then for subsequent accesses to that expression always return the same value. This is almost never a problem, even for loops because a new Petal::Hash object is used for each iteration in order to support proper scoping. However, in some rare cases you might not want to have that behavior, in which case you need to prefix your expression with the C keyword, i.e. fresh string:$foo/bar, ${baz/buz/blah} You can use C with C if you need to: fresh structure string:$foo/bar, ${baz/buz/blah} However the reverse does not work: structure fresh string:$foo/bar, ${baz/buz/blah} =head2 TOY FUNCTIONS (For debugging or if you're curious) =head3 perl -MPetal -e canonical template.xml Displays the canonical template for template.xml. You can set C<$Petal::INPUT> using by setting the PETAL_INPUT environment variable. You can set C<$Petal::OUTPUT> using by setting the PETAL_OUTPUT environment variable. =head3 perl -MPetal -e code template.xml Displays the perl code for template.xml. You can set C<$Petal::INPUT> using by setting the PETAL_INPUT environment variable. You can set C<$Petal::OUTPUT> using by setting the PETAL_OUTPUT environment variable. =head3 perl -MPetal -e lcode template.xml Displays the perl code for template.xml, with line numbers. You can set C<$Petal::INPUT> using by setting the PETAL_INPUT environment variable. You can set C<$Petal::OUTPUT> using by setting the PETAL_OUTPUT environment variable. =head2 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 are under a persistent environment a la mod_perl, subsequent calls to the same template will be reduced to step 8 until the source template changes. Otherwise, subsequent calls will resume at step 6, until the source template changes. If you are using the mod_perl prefork MPM, you can precompile Petal templates into Apache's shared memory at startup by using the cache_only option. This will allow you to run through steps 1-7 without passing any data to Petal. =head1 DECRYPTING WARNINGS AND ERRORS =head2 "Cannot import module $module. Reason: $@" (nonfatal) Petal was not able to import one of the modules. This error warning will be issued when Petal is unable to load a plugin because it has been badly install or is just broken. =head2 "Petal modifier encode: is deprecated" (nonfatal) You don't need to use encode:EXPRESSION to XML-encode expression anymore, Petal does it for you. encode: has been turned into a no-op. =head2 Cannot find value for ... (FATAL) You tried to invoke an/expression/like/this/one but Petal could not resolve it. This could be because an/expression/like evaluated to undef and hence the remaining this/one could not 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 try to determine the faulty bit in your template. =head2 not well-formed (invalid token) at ... (FATAL) Petal was trying to parse a file that is not well-formed XML or that has strange entities in it. Try to run xmllint on your file to see if it's well formed or try to use the $Petal::INPUT = 'XHTML' option. =head2 other errors Either I've forgot to document it, or it's a bug. Send an email to the Petal mailing list. =head1 EXPORTS None. =head1 AUTHOR Copyright 2003 - MKDoc Ltd. Authors: Jean-Michel Hiver, Fergal Daly , and others. This module free software and is distributed under the same license as Perl itself. Use it at your own risk. Thanks to everybody on the list who contributed to Petal in the form of patches, bug reports and suggestions. See README for a list of contributors. =head1 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 Petal-2.25/PaxHeaders.604/README0000644000000000000000000000007411714720667012775 xustar0030 atime=1398329059.584463572 30 ctime=1550088055.141412499 Petal-2.25/README0000644000175000001440000000343011714720667013552 0ustar00nineusers00000000000000Petal - TAL for Perl ==================== Petal stands for "Perl Template Attribute Language". It is inspired from the Zope Page Templates TAL specification, and lets you write elegant, WYSIWYG friendly templates such as:
    • Dummy UserName
    Petal by default processes XML template files (i.e. SVG, XHTML, VoiceXML, whatever) using XML::Parser, however for convenience HTML is also supported (using HTML::TreeBuilder). INSTALLATION To install this module type the following: perl Makefile.PL make make test make install Or better, use CPAN.pm DEPENDENCIES This module requires these other modules and libraries: HTML::TreeBuilder XML::Parser CONTRIBUTORS Those people (sorted by chronological order of first contribution) have helped Petal under the form of suggestions, bug reports, patches or tests. Thanks to everybody! William McKee Lucas Saud Sean M. Burke Chris Croome Paul Arzul Bruno Postle Kurt Stephens Steve Purkis Holland, Mark Ronald Hayden Peter Wilson Fergal Daly Grant McLean (hopefully I didn't forget anybody...) MISCELLEANOUS Join the Petal community! http://lists.webarch.co.uk/mailman/listinfo/petal COPYRIGHT AND LICENCE This module free software and is distributed under the same license as Perl itself. Copyright (C) 2003 MKDoc Ltd. Authors: Jean-Michel Hiver, Fergal Daly , and others. Petal-2.25/PaxHeaders.604/MANIFEST0000644000000000000000000000011613431073567013241 xustar0029 mtime=1550088055.29341298 20 atime=1550088045 29 ctime=1550088055.29341298 Petal-2.25/MANIFEST0000644000175000001440000001321513431073567014023 0ustar00nineusers00000000000000Changes lib/Petal.pm lib/Petal/Cache/Disk.pm lib/Petal/Cache/Memory.pm lib/Petal/Canonicalizer/XHTML.pm lib/Petal/Canonicalizer/XML.pm lib/Petal/CodeGenerator.pm lib/Petal/Cookbook.pod lib/Petal/Deprecated.pod lib/Petal/Entities.pm lib/Petal/Functions.pm lib/Petal/Hash.pm lib/Petal/Hash/String.pm lib/Petal/Hash/Test.pm lib/Petal/Hash/Var.pm lib/Petal/I18N.pm lib/Petal/Parser.pm lib/Petal/TranslationService/Gettext.pm lib/Petal/TranslationService/h4x0r.pm lib/Petal/TranslationService/MOFile.pm lib/Petal/TranslationService/Noop.pm Makefile.PL MANIFEST This list of files META.yml Module meta-data (added by MakeMaker) README t/001_Include.t t/002_Set_Modifier.t t/003_More_Include.t t/004_Misc_Tests.t t/005_If_Nested_Tag.t t/006_Split_Expression.t t/007_String_Modifier.t t/008_Quoted_Params.t t/009_Style_AndAmp.t t/010_XHTML.t t/011_Delete_Attr.t t/012_Prefix.t t/013_Declaration.t t/014_Interpolate.t t/015_Dummy_Data.t t/016_Method_Param.t t/017_Entities.t t/018_String_Count.t t/019_Autoload.t t/020_Comments.t t/021_Canonical_Error.t t/022_Hashref_List.t t/023_Loop_Error.t t/024_Namespaces.t t/025_Omit_Tag.t t/026_Broken_Loop.t t/027_Eval.t t/028_Infinite_Includes.t t/029_Test_NS_Attributes.t t/030_Attributes_AndQuot.t t/031_Escape_Semicolon.t t/032_Hypen_XML.t t/033_Hash.t t/034_Plugin.t t/035_Petal_Language.t t/036_Set_Cache_Fresh.t t/037_Set_Nested_Var.t t/038_Pass_Variables.t t/039_Access_Objects.t t/040_Tests_With_Zero.t t/041_Entities.t t/042_Path_Prefix.t t/043_Basic.t t/044_Comment_With_PI.t t/050_Opt_base_dir.t t/051_Opt_in_out.t t/052_Opt_language.t t/053_Opt_taint.t t/054_Opt_cache.t t/055_Opt_maxinc.t t/060_Metal_Define.t t/061_Metal_Use.t t/062_Metal_Self_Include.t t/063_Nbsp.t t/064_Metal_Double_Include.t t/065_HTML_Attribute_Strip.t t/070_HTML_Errors.t t/071_Encode_Overloaded_Object.t t/072_Metal_Define_Slot.t t/073_Metal_Fill_Slot.t t/080_Petal_TranslationService_h4x0r.t t/081_Petal_I18NProcessor.t t/082_Petal_Gettext.t t/083_test_attributes_chars.t t/084_Cookbook.t t/085_lang_include_memcache.t t/086_lang_include_diskcache.t t/087_dollar_one.t t/088_latin1.t t/089_utf-8.t t/090_dollarone-again.t t/091_attribute-newline.t t/092_on-error.t t/093_translate.t t/094_notfalse.t t/096_oddeven.t t/097_cache_only.t t/098_multiple-attributes.t t/benchmark.pl t/data/access_obj_array.html t/data/access_obj_hash.html t/data/attribute-newline.xml t/data/attribute_strip.html t/data/attributes_andquot.xml t/data/autoload.xml t/data/basic.xml t/data/benchmark.html t/data/canonical_error.html t/data/children.xml t/data/comment_does_not_die.xml t/data/comments.xml t/data/content_encoded.html t/data/cookbook.html t/data/decl.xml t/data/delete_attribute.xml t/data/dollar-one.xml t/data/dollarone-again.xml t/data/dummy_data.xml t/data/entities.html t/data/entities.xml t/data/error_on_undef_var.html t/data/eval.xml t/data/eval2.xml t/data/gettext/html/index.html t/data/gettext/html/menu-no-css.html t/data/gettext/mo/en.mo t/data/gettext/mo/fr.mo t/data/gettext/po/en.po t/data/gettext/po/fr.po t/data/gettext/po/index.pot t/data/hash_mustfail.xml t/data/hash_mustpass.xml t/data/hashref_list.html t/data/html_errors/no_var.html t/data/html_errors/not_xml.html t/data/hypen.xml t/data/i18n-test.html t/data/if.html t/data/if.xml t/data/include/deep/index.xml t/data/include/included.xml t/data/include/index.xml t/data/include/index_xinclude.xml t/data/include/index_xinclude2.xml t/data/infinite_includes.xml t/data/inline_vars.xml t/data/interpolate.xml t/data/language/exists_filename/fr-CA.html t/data/language/exists_filename/fr.xml t/data/language/fr.xml t/data/language/include/fr-CA.html t/data/language/include/fr.html t/data/latin1.xml t/data/locale/es/LC_MESSAGES/testdomain.mo t/data/locale/es/LC_MESSAGES/testdomain.po t/data/locale/fr/LC_MESSAGES/testdomain.mo t/data/locale/fr/LC_MESSAGES/testdomain.po t/data/locale/testdomain.pot t/data/loop_error.xml t/data/manipulate.html t/data/metal-define-slot.html t/data/metal-fill-slot.html t/data/metal_define_macro.xml t/data/metal_double_include/fragment.xhtml t/data/metal_double_include/main.xhtml t/data/metal_self_include.xml t/data/metal_use_macro.xml t/data/method_param.xml t/data/multiple-attributes.xml t/data/multiple_includes/includes/footer.tmpl t/data/multiple_includes/includes/header.tmpl t/data/multiple_includes/register_form.tmpl t/data/multiple_includes/test.tmpl t/data/namespaces.xml t/data/nbsp.html t/data/nested_modifiers/test1.xml t/data/nested_modifiers/test2.xml t/data/notfalse.xml t/data/oddeven.xml t/data/omit-tag.xml t/data/pass_variables/attributes.html t/data/pass_variables/content.html t/data/pass_variables/if.html t/data/pass_variables/ih.html t/data/pass_variables/no_arguments.html t/data/pass_variables/repeat.html t/data/pass_variables/replace.html t/data/pass_variables/set.html t/data/path_prefix.xml t/data/plugin.xml t/data/prefix.xml t/data/quoted_params.xml t/data/set_cache_fresh.xml t/data/set_modifier/index.xml t/data/set_nested_var.html t/data/split_expression.xml t/data/string.xml t/data/string_count.html t/data/style_andamp.html t/data/test_attributes2.xml t/data/test_attributes_chars/test_attributes_chars1.xml t/data/test_ns_attributes/test_ns_attributes1.xml t/data/test_ns_attributes/test_ns_attributes2.xml t/data/test_ns_attributes/test_ns_attributes3.xml t/data/test_ns_attributes/test_ns_attributes4.xml t/data/test_ns_attributes/test_ns_attributes5.xml t/data/test_ns_attributes/test_ns_attributes6.xml t/data/test_ns_attributes/test_ns_attributes7.xml t/data/test_ns_attributes/test_rightWayOfDoing.xml t/data/tests_with_zero.xml t/data/translate.xml t/data/utf-8.xml t/data/xhtml.html t/data/xhtml_omit_tag.html META.json Module JSON meta-data (added by MakeMaker) Petal-2.25/PaxHeaders.604/Changes0000644000000000000000000000013213431073502013366 xustar0030 mtime=1550088002.701246618 30 atime=1550088002.701246618 30 ctime=1550088055.141412499 Petal-2.25/Changes0000644000175000001440000003321713431073502014156 0ustar00nineusers00000000000000Revision history for Petal. 2.25 Wed Feb 13 21:00:00 2019 - Add error_on_include_error option (mreitinger) - add error details to all open() calls to make debugging easier (mreitinger) 2.24 Thu Feb 16 13:10:00 2013 - Add missing requirement to Makefile.PL 2.23 Thu Aug 08 15:50:00 2013 - Fix Petal::Utils installation after regression caused by improved tal:repeat error message 2.22 Sun Feb 24 12:15:00 2013 - Fix caching when specifying a language (RT #55692) - Add LICENSE to Makefile.PL (RT #83585) 2.21 Fri Dec 21 17:40:00 2012 - Improve error message for undef in tal:repeat variables - Don't fail tests if CGI is not installed - Don't run charset tests on Perl < 5.8 - Update TAL/TALES/METAL specification URIs in docs 2.20 Thu Aug 25 13:05:00 2011 - Remove usage of Safe in taint mode to fix compatability with Perl 5.12. This may break existing code and reduces security! But for now it seems better to have at least a working version. (Damyan Ivanov) - Fix code using deprecated UNIVERSAL->import (Stefan Seifert) 2.19 Fri Jun 16 15:22:00 2006 - alias false: modifier as not: to match TALES spec (Jonathan Vanasco) - fix repeat/odd documentation bug and add to cookbook (Jonathan Vanasco) - pod typos (sarabob) - CACHE_ONLY option (Jonathan Vanasco) - Add Digest::MD5 dependency (aaron) - Allow passing arguments to coderefs - Encoding support for gettext mo/po files (Andrew Rodland) 2.18 Tue Jan 17 13:01:00 2006 - $Petal::CodeGenerator::PI_RE should be applied newline insensitively - pod fixes - Cookbook tal:repeat example (DSL) - pod note that on-error isn't fully implemented - defang html metacharacters in on-error output - undo 2.16 $Petal::Hash::String::VARIABLE_RE_BRACKETS ${1} regression 2.17 Wed Sep 7 15:30:00 2005 - test 041 check that   becomes chr(160) not chr(194) (William McKee) - Petal::Canonicalizer::XML Fix bug where \-escaped semicolons were not recognised (William McKee) - test 090 for ${1} appearance when Petal::I18N->process - pod fixes (Kurt Stephens, Tom Metro, Bruno Postle) 2.16 Fri Mar 18 15:30:00 2005 - Added Cookbook.pod documentation and associated tests from William McKee - Removed references to HTML::TreeBuilder and XML::Parser (William McKee) - Skip test 071 when URI.pm not installed (William McKee) - Added tests 085 & 086 demonstrating breakage when using {disk,mem} cache and multi-language includes - $Petal::Hash::String::VARIABLE_RE_BRACKETS no longer treats ${1} as a variable - Fix that adds language to the mix when generating cache keys - tests 088 & 089 check for correct decode_charset behaviour - Fix to allow decode_charset to be other than utf-8 (William McKee) 2.15 Wed Jan 5 15:31:00 2005 - Fixed some 'used of uninitialized values' warnings - Added support for non-alphanumeric xml attribute names in tal:attributes - removed defunct email address 2.14 Thu Sep 2 15:07:39 2004 - Fixed broken I18N attributes parsing - Added I18N to string: 2.13 Mon Aug 9 11:32:12 2004 - Stopped Petal doing I18N stuff for includes - Fixed Petal::TranslationService::Gettext wrongly using noop 2.12 Fri Aug 6 13:58:55 2004 - Added namespace support to Petal::I18N - Added Petal::TranslationService::Noop - Added Petal::TranslationService::Gettext - Revamped Petal::I18N docs - Added some I18N tests 2.11 Fri Jul 23 13:10:30 2004 - Applied Warren Smith's dereferencing patch - Fixed broken tests for I18N 2.10 Thu Jul 22 15:12:51 2004 - Added experimental ZPT I18N support - Updated documentation - Added a bunch of tests - Added a patch to get Petal to resolve SCALAR entities 2.07 Thu Jun 24 13:13:57 2004 - Added metal:define-slot - Added metal:fill-slot 2.06 Fri Jun 4 14:41:58 2004 - Added HTML Errors mode - Fixed Petal not encoding overloaded objects - Made the canonicalizer strip declarations on included files 2.05 Mon Apr 5 14:14:46 2004 - Fixed broken test 2.04 Thu Mar 18 17:33:45 2004 - Added broken attributes parsing test - Updated MKDoc::XML dependency 2.03 Mon Mar 15 16:25:59 2004 - Don't ask me what happened with 2.02 - Added a test case for metal double include 2.01 Wed Dec 10 15:21:35 2003 - Deprecated $Petal::ENCODE - Petal now always returns in Perl's internal format 2.00 Thu Nov 6 12:05:13 2003 - This version *can* break backwards compatibility - Simple re-release of 1.10_09 which seems stable 1.10_09 - Fixed CodeGenerator not backslashing backslashes properly - Fixed repeat/end bug - Added warning in case of weird-looking 'attributes' statement 1.10_08 - Fixed metal:use-macro not being parsed in XHTML output mode - Fixed unnecessary warning 1.10_07 - Added incomplete METAL implementation 1.10_06 - Uncommented TAINT stuff (again!) - Refactored to work with MKDoc::XML 0.60 - Changed CodeGenerator.om decode_backslash_semicolon mechanism - Fixed Petal dying on <--! --> comments - Fixed generate_events_comment incorrectly encoding entities 1.10_05 - Changed the rules for when HTML entities are decoded 1.10_04 - Fixed infinite recursion on non-existent modifiers 1.10_03 - Fixed File::Spec use of uninitialized values - Fixed somehow broken Petal::_process_absolutize_pathes() - Fixed entities test running nothing when using perl 5.6.x 1.10_02 - Changed Petal to ignore Encode if Perl < 5.007 - Fixed a @BASE_DIR inconsistency in process() - Fixed potential caching bug on non Unix platforms 1.10_01 - Changed Petal's parsing backend to MKDoc::XML::TreeBuilder - Added prefixes in path expressions, i.e. /foo/var:bar - Refactored Petal's use of the Encode module 1.06 Wed Aug 20 17:41:21 2003 - fixed omit-tag="" bug - Include errors are now reported in HTML comments - Fixed 'lots of includes' performance issues - Fixed a bug pointed out by Fergal concerning entities 1.05 Tue Aug 19 15:39:16 2003 - Fixed silly warning bug - Added decoding HTML entities capability 1.04 Sun Aug 17 19:57:40 2003 - Fixed repeat object and safe issues - Added Test::Harness and Scalar::Util dependencies - Fixed a bug in the way patch for code padding - Fixed bug 0.64 Tue Sep 03 15:48:23 2002 - Fixed extra AUTOLOAD bug - Fixed _split_expression critical bug - Added test - Sorry for the broken 0.63 release :-( 0.63 Mon Sep 02 17:01:23 2002 - Fixed petal:repeat documentation bug - Changed Petal::Parser::HTMLWrapper to preserve ignorable whitespaces - Fixed Petal stripping comments with Petal::Parser::HTMLWrapper - Fixed Petal not invoking methods which are defined via AUTOLOAD - Changed Petal::Canonicalizer::_split_expression to work with Perl 5.8.0 - Changed Petal::Canonicalizer::_split_expression to remove warnings 0.62 Fri Aug 16 11:17:10 2002 - Fixed entity bug due to XML::Parser expanding entities - Fixed method parameters bug - Fixed another method parameters bug - Fixed a couple of small documentation bugs - Fixed an XML declaration bug - Fixed '"' being converted to '"' by Petal::Parser::HTMLWrapper 0.61 Mon Aug 12 11:50:50 2002 - Fixed 'dummy content' closing tag bug - Fixed bugfix bug! 0.6 Sat Aug 10 14:59:53 2002 - Fixed bug - Fixed declarations being striped out - Fixed being turned into bug - Fixed petal:attributes="style nothing" does not delete 'style' *K* - Fixed Petal::CodeGenerator bug - Fixed a bug that prevented __is_last__ from being accessed - Applied William's patch to reduce amount of issued warnings - Changed the cache modules w/ new $Petal::INPUT and $Petal::OUTPUT - Implemented $Petal::INPUT and $Petal::OUTPUT for XHTML 0.5 Sat Aug 03 19:56:13 2002 - Modifiers are now 'modifier:' rather than ':modifier' - Modifiers are now stackable (i.e. foo:bar:baz/buz) - Implemented TALES-like slash '/' as an alias for dot '.' - Rewrote Petal::Parser::HTMLWrapper using newest HTML::TreeBuilder - Fixed more include bugs - Amended documentation - Implemented string: modifier 0.4 Thu Jul 25 12:08:03 2002 - Added Petal::Hash::Encode_HTML contributed mod - Fixed documentation bugs - Fixed multiple includes bug - Fixed Petal::Parser::HTMLWrapper includes - Added warning for Petal statements with missing '?' 0.3 Fri Jul 19 11:20:30 2002 - Fixed critical include bug - Added version number to cached file names - Added more tests - Updated documentation - Fixed wrong MANIFEST file - Updated README file 0.2 Tue Jul 16 11:54:55 2002 - Fixed critical bug in Petal::Canonicalizer - Fixed documentation bug - Added first test in /t 0.1 Mon Jul 15 11:29:22 2002 - Initial release Petal-2.25/PaxHeaders.604/Makefile.PL0000644000000000000000000000013213051312763014050 xustar0030 mtime=1487246835.924461536 30 atime=1487246835.924461536 30 ctime=1550088055.153412537 Petal-2.25/Makefile.PL0000644000175000001440000000152213051312763014632 0ustar00nineusers00000000000000use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Petal', 'VERSION_FROM' => 'lib/Petal.pm', # finds $VERSION LICENSE => 'perl', 'PREREQ_PM' => { 'Test::Harness' => '2.00', 'Scalar::Util' => '1.07', 'MKDoc::XML' => '0.72', 'Digest::MD5' => '0', 'Locale::Maketext::Gettext' => '0', }, ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/Petal.pm', # retrieve abstract from module AUTHOR => 'Jean-Michel Hiver') : ()), ); 1; package MY; sub postamble { return < /dev/null EOF } 1; Petal-2.25/PaxHeaders.604/META.yml0000644000000000000000000000013213431073567013357 xustar0030 mtime=1550088055.189412651 30 atime=1550088055.161412562 30 ctime=1550088055.193412663 Petal-2.25/META.yml0000644000175000001440000000122013431073567014134 0ustar00nineusers00000000000000--- abstract: 'Perl Template Attribute Language - TAL for Perl!' author: - 'Jean-Michel Hiver' build_requires: ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Petal no_index: directory: - t - inc requires: Digest::MD5: '0' Locale::Maketext::Gettext: '0' MKDoc::XML: '0.72' Scalar::Util: '1.07' Test::Harness: '2.00' version: '2.25' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Petal-2.25/PaxHeaders.604/META.json0000644000000000000000000000013213431073567013527 xustar0030 mtime=1550088055.245412827 30 atime=1550088055.193412663 30 ctime=1550088055.245412827 Petal-2.25/META.json0000644000175000001440000000207613431073567014316 0ustar00nineusers00000000000000{ "abstract" : "Perl Template Attribute Language - TAL for Perl!", "author" : [ "Jean-Michel Hiver" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Petal", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Digest::MD5" : "0", "Locale::Maketext::Gettext" : "0", "MKDoc::XML" : "0.72", "Scalar::Util" : "1.07", "Test::Harness" : "2.00" } } }, "release_status" : "stable", "version" : "2.25", "x_serialization_backend" : "JSON::PP version 4.00" }
  • Child Document Title
    • Dummy Child 1
    • Dummy Child 2
    • Dummy Child 3