=head1 NAME
HTML::Seamstress::Quickstart - A gentle introduction to HTML::Seamstress
=head1 Introduction
This guide is designed to get you started with dynamically generating
and modifying ("templating") HTML with
L.
We will work through several examples, with each one increasing your
ability to work with Seamstress effectively.
=head2 Sample files
All the files for the samples are in the directory
F
=head1 Pure TreeBuilder
Welcome to the first example. This is our bare-bones example. Let's
say we want to dynamically modify the following HTML:
pod_code 'Quickstart/html/greeting.html'
Let's not use Seamstress at all in this case. Remember Seamstress just
makes using L more convenient when writing
software - it is completely optional and totally non-magical. So
here's the (admittedly verbose) pure TreeBuilder solution:
pod_code 'Quickstart/greeting-treebuilder.pl'
There's a convenience function in
L which
makes it easy to replace all the content of an element. This will make
our script shorter. If we simply use Seamstress, its
C method will bless the
HTML tree into a class which inherits from HTML::Element::Library,
making it easy for us to shorten our program. So let's rework the
example using bare-bones Seamstress.
=head1 Base bones Seamstress rework
Since we used HTML::Seamstress instead of HTML::TreeBuilder, our
C<$tree> was blessed as an instance of C. Since
C inherits from C and
C, we have a C<$tree> which can use the
methods of both.
We will take advantage of the C method in
L to shorten our
program:
pod_code 'Quickstart/greeting-seamstress-pure.pl'
Now of course, this program is just itching to not repeat itself, so
we will clean it up just a tad:
pod_code 'Quickstart/greeting-seamstress-pure-mapped.pl'
=head1 Abstract the file and our operations on it into a Perl LOOM
Ok sweet, we have a nice tight program. But is this really
application-level code? As the user of ultra-scaffolded frameworks
such as L and L, I can say
no. Our inline code must
be much tighter. It must do no more than C