Fixup
This commit is contained in:
@@ -24,8 +24,8 @@
|
|||||||
I like writing Perl, I want to write Perl, so when I have to switch contexts to HTML it annoys me. To compound this problem, I just got off a project that used a tool called
|
I like writing Perl, I want to write Perl, so when I have to switch contexts to HTML it annoys me. To compound this problem, I just got off a project that used a tool called
|
||||||
<a href="https://github.com/weavejester/hiccup">hiccup</a>, hiccup let me write code in its native toungue (Clojure), and get back HTML in the form of a string. This rocked!
|
<a href="https://github.com/weavejester/hiccup">hiccup</a>, hiccup let me write code in its native toungue (Clojure), and get back HTML in the form of a string. This rocked!
|
||||||
Not only did I not have to write HTML, it was actually <i>intuitive</i>, it provided me with a DSL for HTML. So I took this idea, and ported it to Perl, in the form of
|
Not only did I not have to write HTML, it was actually <i>intuitive</i>, it provided me with a DSL for HTML. So I took this idea, and ported it to Perl, in the form of
|
||||||
<a href="https://metacpan.org/pod/HTML::Composer">HTML::Composer</a>. HTML::Composer is a library that does its best to emulate that sort of intuitiveness, and to my surprise,
|
<a href="https://metacpan.org/pod/HTML::Composer">HTML::Composer</a>. HTML::Composer is a library that does its best to emulate that sort of intuitiveness, inside of Perl. To my surprise
|
||||||
it seems to.
|
it seems to, and even more suprisingly, it performs incredibly well.
|
||||||
</p>
|
</p>
|
||||||
<h2>HTML::Composer</h2>
|
<h2>HTML::Composer</h2>
|
||||||
<p>
|
<p>
|
||||||
@@ -66,10 +66,10 @@ my $html = $h->partial([
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
say $html;
|
say $html; # <div>Hello, World!<a href="https://www.google.com"< ...
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>
|
<p>
|
||||||
Since HTML::Composer operates inside of Perl data structures, and doesn't need to parse HTML, it's quite fast. Faster than any other HTML templating library I could find.
|
Since HTML::Composer operates inside of Perl data structures, and doesn't need to do any string parsing, it's quite fast. Faster than any other templating library outputting HTML I could find.
|
||||||
The following benchmark is the average of five different one-hundred-million iteration runs rendering a medium sized HTML page that changed between iterations,
|
The following benchmark is the average of five different one-hundred-million iteration runs rendering a medium sized HTML page that changed between iterations,
|
||||||
with the caveat being, each of these libraries was expected to take an input scalar and output to a scalar variable (Text::Xslate is optimized to read from a file not a string, so it hated this benchmark):
|
with the caveat being, each of these libraries was expected to take an input scalar and output to a scalar variable (Text::Xslate is optimized to read from a file not a string, so it hated this benchmark):
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user