Text::PORE::Object - PORE Objects
$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;
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().
new
setAttribute()
setAttributes()
getAttribute()
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.
$obj->getAttribute($name);
This method retrieves the value of the given attribute. If the attribute is an object, its reference is returned.
$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.
$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.
Zhengrong Tang, ztang@cpan.org
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.
To install Text::PORE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::PORE
CPAN shell
perl -MCPAN -e shell install Text::PORE
For more information on module installation, please visit the detailed CPAN module installation guide.