NAME
OODoc::Text - text component as found in a manual
INHERITANCE
OODoc::Text
is a OODoc::Object
OODoc::Text is extended by
OODoc::Text::Default
OODoc::Text::Diagnostic
OODoc::Text::Example
OODoc::Text::Option
OODoc::Text::Structure
OODoc::Text::Subroutine
SYNOPSIS
# Cannot be instantiated itself
DESCRIPTION
The parsers (implemented in the OODoc::Parser classes) scan the documentation as written down by the author of the module, and build a tree of these OODoc::Text objects from it. Then, any formatter (implemented by the OODoc::Format classes) can take this tree of text objects and convert it into manual pages.
OVERLOADED
overload: '""' (stringification)
Returned is the name of the text object.
overload: '==' and '!='
Numeric comparison is used to compare to objects whether they are identical. String comparison is overloaded to compare the names of the objects.
overload: 'cmp' (string comparison)
Names are compared.
METHODS
Constructors
OODoc::Text->new(OPTIONS)
Option Defined in Default
container <required>
description C<''>
linenr <required>
name undef
type <required>
. container OBJECT
All text objects except chapters are contained in some other object.
. description STRING
The text which is contained in the body of this text item. Often, this is filled in later by openDescription().
. linenr INTEGER
. name STRING
The name contains the main data about the text piece.
. type STRING
The type of this text element. This is used for debugging only.
Inheritance knowledge
$obj->extends([OBJECT])
Attributes
$obj->container([OBJECT])
The text element which encapsulates the text element at hand. This defines the structure of the documentation. Only for chapters, this value will be undefined.
$obj->description
Returns the description text for this object. Nearly all objects contains some kind of introductory description.
$obj->name
The name of this text element. Stringification is overloaded to call this name method.
Example:
print $text->name;
print $text; # via overload
$obj->type
Returns the type name of this data object.
Location
$obj->manual([NAME])
Without a NAME, the manual of the text object is returned. With a NAME, the manual with that name is returned, even when that does not have a relation to the object: it calls OODoc::Object::manual().
$obj->unique
Returns a unique id for this text item. This is the easiest way to see whether two references to the same (overloaded) objects point to the same thing. The ids are numeric.
Example:
if($obj1->unique == $obj2->unique) {...}
if($obj1 == $obj2) {...} # same via overload
$obj->where
Returns the source of the text item: the filename name and the line number of the start of it.
Collected
$obj->example(OBJECT)
Add a new example (a OODoc::Text::Example object) to the list already in this object. You can not look for a specific because they have no real name (only a sequence number).
$obj->examples
Returns a list of all examples contained in this text element.
$obj->findDescriptionObject
From the current object, search in the extends until an object is found which has a content for the description field.
$obj->openDescription
Returns a reference to the scalar which will contain the description for this object.
Example:
my $descr = $text->openDescription;
$$descr .= "add a line\n";
Commonly used functions
$obj->filenameToPackage(FILENAME)
OODoc::Text->filenameToPackage(FILENAME)
$obj->mkdirhier(DIRECTORY)
OODoc::Text->mkdirhier(DIRECTORY)
Manual Repository
$obj->addManual(MANUAL)
$obj->mainManual(NAME)
$obj->manuals
$obj->manualsForPackage(NAME)
$obj->packageNames
DIAGNOSTICS
Error: manual definition requires manual object
A call to addManual() expects a new manual object (a OODoc::Manual), however an incompatible thing was passed. Usually, intended was a call to manualsForPackage() or mainManual().
Error: no text container specified for the $type object
Each text element is encapsulated by an other text element, except chapters. A value must be known for this container
option to define the elements relative location.
REFERENCES
See the OODoc website at http://perl.overmeer.net/oodoc/ for more details.
COPYRIGHTS
Module version 0.08. Written by Mark Overmeer (mark@overmeer.net). See the ChangeLog for other contributors.
Copyright (c) 2003 by the author(s). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.