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     --Default
  container    <required>
  description  ''
  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])

See "Inheritance knowledge" in OODoc::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)

See "Commonly used functions" in OODoc::Object

$obj->mkdirhier(DIRECTORY)

OODoc::Text->mkdirhier(DIRECTORY)

See "Commonly used functions" in OODoc::Object

Manual Repository

$obj->addManual(MANUAL)

See "Manual Repository" in OODoc::Object

$obj->mainManual(NAME)

See "Manual Repository" in OODoc::Object

$obj->manuals

See "Manual Repository" in OODoc::Object

$obj->manualsForPackage(NAME)

See "Manual Repository" in OODoc::Object

$obj->packageNames

See "Manual Repository" in OODoc::Object

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.

SEE ALSO

This module is part of OODoc distribution version 1.06, built on January 26, 2011. Website: http://perl.overmeer.net/oodoc/

LICENSE

Copyrights 2003-2011 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html