NAME

Text::PORE::Object - PORE Objects


SYNOPSIS

        $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

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

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

Zhengrong Tang, ztang@cpan.org


COPYRIGHT

Copyright 2004 by Zhengrong Tang

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.