Not exactly if I look at speed.

DOM parsing is costly, I have considered that approach, but I would do it only in the design phase of the application and deployment, or after changes made to some template, its to say I wouldn't use it as the page generating core.

I ran benchmark on a 5649 Byte html file with HTML::Seamstress and Servlet.

The only changes were uncomment use warnings because it clutters up the test with warnings about unitialized variables, and changed the warn "PROCESS_TREE: ", $tree->as_HTML; to a print statement.
No replace_content at all.

bench.pl:

#!/usr/bin/perl use lib "."; use Benchmark qw(:all) ; use Servlet qw(servlet); use example; # the spkg.pl generated package open(O,">/dev/null"); select O; # initialize some empty references I need in example.al my $freelist = []; my $list = []; my $in = {}; my $r = example->new; my $s = servlet( in => 'example.html', args => [ qw($nm $list $em8 $error $in $scopename $ref $res +ult $em26 $link $freelist $networkname $em14 $em9 %oui) ], ); my $count = 10000; my $results = timethese($count, { 'Seamstress' => sub { $r->process() }, 'Servlet' => sub { $s->($nm, $list, $em8, $error, $in, $scopena +me, $ref, $result, $em26, $link, $freelist, $networkname, $em14, $em9 +, %oui) }, }); select STDOUT; cmpthese($results);
gave the following results:
Rate Seamstress Servlet Seamstress 242/s -- -99% Servlet 47619/s 19548% --
I would replace_content with variable stubs and turn the resulting file inside out, as with my code.

greetings,
--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re^2: RFC: Templating without a System by shmem
in thread RFC: Templating without a System by shmem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.