|
FAQ::OMatic::API - a Perl API to manipulate FAQ-O-Matics |
FAQ::OMatic::API - a Perl API to manipulate FAQ-O-Matics
use FAQ::OMatic::API; my $fom_api = new FAQ::OMatic::API();
FAQ::OMatic::API is a class that makes HTTP requests to a FAQ-O-Matic.
It provides a way to manipulate a FAQ-O-Matic from Perl code. Operations
are performed by making HTTP requests on the FAQ-O-Matic server;
this ensures that any operation is performed in exactly the same environment
as it would be if it were requested by a human using a web browser.
The following methods are used to set up an API object.
FAQ::OMatic::API object that points at the FAQ
whose CGI is at $url. Requests will be authenticated on behalf of
FAQ user $id using password $pass.
id and password at runtime.
The following methods retrieve information about a FAQ-O-Matic.
getCategories()getItem($filename)$filename
from the FAQ. You can perform operations on the result such as:
print $item->getTitle();
$parentItem = $item->getParent();
print $item->displayHTML({'render'=>'text'});
my ($rc, $result) = $fom_api->fuzzyMatch(['Parent Category','child cat']) die $result if (not $rc); my $item = $fom_api->getItem($result->[0]);
fuzzyMatch() attempts to figure out which category the last string
in its array argument represents. The category name is matched ``fuzzily''
against existing categories. If a unique match is found, it is returned
(as an array ref [$filename, $parent, $title]). If the match is
ambiguous, the previous array element is matched against the parents
of the set of fuzzy matches. This is performed recursively until the
child category is disambiguated.
Fuzzy matching means that
The following methods perform operations on a FAQ-O-Matic.
$parent.
The new answer has title $title and a single text part containing
$text.
|
FAQ::OMatic::API - a Perl API to manipulate FAQ-O-Matics |