Document::Toc - Manage a Table of contents file.
use Document::Toc; @pagelist = $obj->pages; @titles = $obj->pageTitles ($pageid); @categories = $obj->pageTitleCategories ($pageid, $title); $flg = $obj->havePage ($pageid); $flg = $obj->havePageTitle ($pageid, $title); $flg = $obj->havePageTitleCategory ($pageid, $title, $category); $flg = $obj->addPages (@pageids); $flg = $obj->addPageTitles ($pageid, @titles); $flg = $obj->addPageTitleCategories ($pageid, $title, @categories); $flg = $obj->removePages (@pageid); $flg = $obj->removePageTitles ($pageid, @titles); $flg = $obj->removePageTitleCategories ($pageid,$title,@categories); $flg = $obj->replacePageTitle ($pageid, $oldtitle, $newtitle); @curselection = $obj->setpage ($page); @curselection = $obj->settitle ($title); @curselection = $obj->setcategories; @curselection = $obj->setmark ($page, $title); @curselection = $obj->setfirstpage; @curselection = $obj->setfirsttitle; $page = $obj->curpage; $title = $obj->curtitle; @pages = $obj->curpages; @titles = $obj->curtitles; @categories = $obj->curcategories; @members = $obj->members; $flg = $obj->isMember ($member); $flg = $obj->addMembers (@members); $flg = $obj->removeMembers (@members);
UNIVERSAL Document::Members Document::Toc
This Class manages a table of contents object. A table of contents is keyed by pageids; each pageid may have zero or more titles; each title may belong to zero or more categories. It encodes the semantics of a .toc file.
001 cover 002 contents 003 -- 005 ArticleTitleOne Space, Aeronautics 005 ArticleTitleTwo Biology, Genetics 006 backcover
into an easily modifiable and searchable form.
use Document::Toc; my $toc = Document::Toc->new; my $f = $toc->addPages ("001","002","003","005","006"); $f = $toc->addPageTitles ("002","TitleOne","TitleTwo"); $f = $toc->addPageTitleCategories ("002","TitleTwo","Biology","Genetics"); $f = $toc->addPageTitles ("003","TitleOne","TitleTwo"); $f = $toc->addPageTitleCategories ("003","TitleTwo","Biology","Genetics"); $f = $toc->addPageTitles ("005","TitleOne","TitleTwo"); $f = $toc->addPageTitleCategories ("005","TitleTwo","Biology","Genetics"); my @pages = $toc->pages; my @titles = $toc->pageTitles ("005"); my @categories = $toc->pageTitleCategories ("005", "TitleTwo"); $f = $toc->havePage ("001"); $f = $toc->havePageTitle ("005","TitleTwo"); $f = $toc->havePageTitleCategory ("005","TitleTwo","Biology"); $f = $toc->removePages ("002","006"); $f = $toc->removePageTitles ("003","TitleOne"); $f = $toc->removePageTitleCategories ("005","TitleTwo","Genetics"); $f = $toc->replacePageTitle ("005","TitleTwo","NewTitle"); my @cursel = $toc->setpage ("005"); @cursel = $toc->settitle ("TitleTwo"); @cursel = $toc->setcategories; @cursel = $toc->setmark ("003","TitleTwo"); @cursel = $toc->setfirstpage; @cursel = $toc->setfirsttitle; my $page = $toc->curpage; my $title = $toc->curtitle; @pages = $toc->curpages; @titles = $toc->curtitles; @categories = $toc->curcategories; @pages = $toc->members; $f = $toc->isMember ("001"); $f = $toc->addMembers ("004"); $f = $toc->removeMembers ("003");
None.
Overrides parent and calls addPages.
Add new pageids to the toc with a blank title and no categories. True if it succeeds. Existing pages are unaffected.
Merge new categories into the list of categories associated with title on the specified page. True if it succeeds. Existing categories are unaffected.
Add new titles to an existing pageid. True if it succeeds. Existing titles are unaffected. Note that a blank title really is "" and not represented by "--" as in a TocFile!
Return a list of all categories in the current page and table selection or an empty array.
Return the current page name or undef if there is none.
Return a list of all pages in this Toc or undef if empty.
Return the current title or undef if there is none.
Return a list of all titles on the current page or undef if there are none.
True if $pageid exists.
True if $title exists on $pageid.
True if $category is in use for $title on $pageid.
Overrides parent and calls havePage.
Overrides parent and calls pages.
Return a list of the pageids in the toc. List may be empty.
Return a list of all the categories associated with a specific page title. List can be empty if there is no assignment of the title to a category or categories yet.
Return a list of the page titles associated with a specific pageid found in the .toc. List can be empty as there will always be one untitled entry for each page in the Archivist::Publication's directory.
Change the a title name without disturbing its' associated categories. Success means a new title was created, given the category hash of the old title, and the old title was deleted.
Overrides parent and calls removePages.
Remove pageids from the hash. Will remove all titles and their associated categories that are part of the specified pages. Ignores pages that don't exist. Returns true if the operation succeeds.
Remove titles and their associated categories from a pageid. Ignores titles that don't exist. Returns true on success.
Remove categories from the specified title on the specified pageids. Ignores categories which don't exist. Returns true on success.
Set the selection mark to start with the categories associated with the current title. Return the modified current selection.
Set the selection mark to the firstpage. Return the modified current selection.
Set the selection mark to the first title on the current page. Return the modified current selection.
Set the selection mark to start with the specified page and title. Return the modified current selection.
Set the selection mark to start with the specified page. Return the modified current selection.
Set the selection mark to start with the specified title on the current page. Return the modified current selection.
SUBCLASS MAY CHAIN. Chains to parent class method. If the lazy evaluation bit is set, do evaluations and then clear it. Returns true if subclass should carry out it's own lazy evaluation.
This is an internal primitive operation on the members data. It assumes you know what you are doing because if you screw up the lazy evaluation you could create some really subtle bugs.
See TODO.
Document::Members, Fault::DebugPrinter
Dale Amon <amon@vnl.com>
2 POD Errors
The following errors were encountered while parsing the POD:
=back doesn't take any parameters, but you said =back 4
To install Document::Toc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Document::Toc
CPAN shell
perl -MCPAN -e shell install Document::Toc
For more information on module installation, please visit the detailed CPAN module installation guide.