Text::PORE::Object - PORE Objects


Text-PORE documentation  | view source Contained in the Text-PORE distribution.

Index


NAME

Top

Text::PORE::Object - PORE Objects

SYNOPSIS

Top

	$obj = new Text::PORE::Object('name'=>'Joe Smith');
	@chilren = (
		new Text::PORE::Object('name'=>'John Smith', 'age'=>10, 'gender'=>'M'),
		new Text::PORE::Object('name'=>'Jack Smith', 'age'=>15, 'gender'=>'M'),
		new Text::PORE::Object('name'=>'Joan Smith', 'age'=>20, 'gender'=>'F'),
		new Text::PORE::Object('name'=>'Jim Smith', 'age'=>25, 'gender'=>'M'),
	);
	$obj->{'children'} = \@chilren;

DESCRIPTION

Top

PORE::Object is the superclass of all renderable objects. That is, if you want to render an object, the object must be an instance of PORE::Object or an instance of its subclass.

The purpose of this class is to provide methods to create and access attributes. Attributes can be created via the constructor new and setters setAttribute() and setAttributes(). Attributes can be retrieve via the getter getAttribute().

METHODS

Top

new

Usage:

	new Text::PORE::Object();
	new Text::PORE::Object($name1=>$value1, $name2=>$value2, ..., $nameN=>$valueN);

The constructor can take no argument or a list of name-value pairs. If a list of name-value pairs is provided, the object is created with the given attributes.

getAttribute()

Usage:

	$obj->getAttribute($name);

This method retrieves the value of the given attribute. If the attribute is an object, its reference is returned.

setAttribute()

Usage:

	$obj->setAttribute($name=>$value);

This method takes a name-value pair. It sets the attribute for the given name to the given value. If the attribute previously has an old value, the new value overrides the old one.

setAttributes()

Usage:

	$obj->setAttributes($name1=>$value1, $name2=>$value2, ..., $nameN=>$valueN);

This method takes a list of name-value pairs. It sets the attribute for each given name to its corresponding value. If the attribute previously has an old value, the new value overrides the old one.

AUTHOR

Top

Zhengrong Tang, ztang@cpan.org

COPYRIGHT

Top


Text-PORE documentation  | view source Contained in the Text-PORE distribution.