spkg - Create Perl packages for HTML files for HTML::Seamstress manipulation
spkg [options] html_file
base_pkg_root $base_pkg_root
The directory to add to @INC so that base_pkg is found
@INC
base_pkg
base_pkg $base_pkg
The base package containing a method comp_root which returns the absolute path to the HTML file to be processed.
This package must be on @INC and it's up to you to put it there :)
Most commonly, you will have a directory layout like this:
/home/metaperl/perl/src/seamstress/ctb: total 92 drwxr-xr-x 5 metaperl metaperl 4096 Oct 31 03:46 . drwxr-xr-x 10 metaperl metaperl 4096 Sep 22 01:52 .. drwxr-xr-x 4 metaperl metaperl 4096 Oct 31 03:45 HTML drwxr-xr-x 4 metaperl metaperl 4096 Sep 21 00:33 html /home/metaperl/perl/src/seamstress/ctb/HTML: total 16 drwxr-xr-x 4 metaperl metaperl 4096 Oct 31 03:45 . drwxr-xr-x 5 metaperl metaperl 4096 Oct 31 03:46 .. drwxr-xr-x 3 metaperl metaperl 4096 Oct 31 03:45 Seamstress /home/metaperl/perl/src/seamstress/ctb/HTML/Seamstress: total 20 drwxr-xr-x 3 metaperl metaperl 4096 Oct 31 03:45 . drwxr-xr-x 4 metaperl metaperl 4096 Oct 31 03:45 .. -rw-r--r-- 1 metaperl metaperl 95 Oct 31 03:17 Base.pm /home/metaperl/perl/src/seamstress/ctb/html: total 32 drwxr-xr-x 4 metaperl metaperl 4096 Sep 21 00:33 . drwxr-xr-x 5 metaperl metaperl 4096 Oct 31 03:46 .. -rw-r--r-- 1 metaperl metaperl 246 Sep 21 00:30 hello_world.html -rw-r--r-- 1 metaperl metaperl 818 Sep 21 00:30 hello_world.pm
and you will call spkg like this:
spkg --base HTML::Seamstress::Base html/hello_world.html
Thus creating html::hello_world which you can use in your Perl programs by simply typing:
html::hello_world
require html::hello_world; html::hello_world->new;
creating an HTML::TreeBuilder style tree for processing.
Template and HTML::Mason both create objects which they configure with an INCLUDE_PATH or comp_root, respectively. Seamstress leverages Perl's standard include mechanism to find HTML files. As such, a c<base_pkg> with a method that will allow runtime requires of such packages is needed.
INCLUDE_PATH
comp_root
require
1 POD Error
The following errors were encountered while parsing the POD:
=back without =over
To install HTML::Seamstress, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Seamstress
CPAN shell
perl -MCPAN -e shell install HTML::Seamstress
For more information on module installation, please visit the detailed CPAN module installation guide.