PerlBean::Collection - contains a collection of PerlBean objects
use strict; use PerlBean; use PerlBean::Collection; use PerlBean::Attribute::Factory; my $bean = PerlBean->new( { package => 'Athlete', } ); my $factory = PerlBean::Attribute::Factory->new(); my $attr = $factory->create_attribute( { method_factory_name => 'name', short_description => 'the name of the athlete', } ); $bean->add_method_factory($attr); my $bean2 = PerlBean->new( { package => 'Cyclist', base => [ qw(Athlete)], } ); my $factory = PerlBean::Attribute::Factory->new(); my $attr2 = $factory->create_attribute( { method_factory_name => 'cycle', short_description => 'the cyclist\'s cycle', } ); $bean2->add_method_factory($attr2); my $collection = PerlBean::Collection->new(); $collection->add_perl_bean($bean); $collection->add_perl_bean($bean2); $collection->write('tmp');
Code hierarchy generation for bean like Perl modules
PerlBean::Collection contains a collection of PerlBean objects in order to generate an hierarchy of Perl modules.
PerlBean::Collection
PerlBean
Creates a new PerlBean::Collection object. OPT_HASH_REF is a hash reference used to pass initialization options. On error an exception Error::Simple is thrown.
OPT_HASH_REF
Error::Simple
Options for OPT_HASH_REF may include:
license
Passed to set_license().
perl_bean
Passed to set_perl_bean(). Must be an ARRAY reference.
ARRAY
Add additional values on the list of PerlBean objects in the collection. Each VALUE is an object out of which the id is obtained through method get_package(). The obtained key is used to store the value and may be used for deletion and to fetch the value. 0 or more values may be supplied. Multiple occurrences of the same key yield in the last occurring key to be inserted and the rest to be ignored. Each key of the specified values is allowed to occur only once. On error an exception Error::Simple is thrown.
VALUE
get_package()
Delete elements from the list of PerlBean objects in the collection. Returns the number of deleted elements. On error an exception Error::Simple is thrown.
Returns the count of items in ARRAY that are in the list of PerlBean objects in the collection.
Returns the software license for the PerlBean collection.
Returns an ARRAY containing the keys of the list of PerlBean objects in the collection.
Set the software license for the PerlBean collection. VALUE is the value. On error an exception Error::Simple is thrown.
Set the list of PerlBean objects in the collection absolutely using values. Each VALUE is an object out of which the id is obtained through method get_package(). The obtained key is used to store the value and may be used for deletion and to fetch the value. 0 or more values may be supplied. Multiple occurrences of the same key yield in the last occurring key to be inserted and the rest to be ignored. Each key of the specified values is allowed to occur only once. On error an exception Error::Simple is thrown.
Returns an ARRAY containing the values of the list of PerlBean objects in the collection. If KEY_ARRAY contains one or more KEYs the values related to the KEYs are returned. If no KEYs specified all values are returned.
KEY_ARRAY
KEY
Write the hierarchy of Perl class code to DIRECTORY. DIRECTORY is a directory name. On error an exception Error::Simple is thrown.
DIRECTORY
PerlBean, PerlBean::Attribute, PerlBean::Attribute::Boolean, PerlBean::Attribute::Factory, PerlBean::Attribute::Multi, PerlBean::Attribute::Multi::Ordered, PerlBean::Attribute::Multi::Unique, PerlBean::Attribute::Multi::Unique::Associative, PerlBean::Attribute::Multi::Unique::Associative::MethodKey, PerlBean::Attribute::Multi::Unique::Ordered, PerlBean::Attribute::Single, PerlBean::Dependency, PerlBean::Dependency::Import, PerlBean::Dependency::Require, PerlBean::Dependency::Use, PerlBean::Described, PerlBean::Described::ExportTag, PerlBean::Method, PerlBean::Method::Constructor, PerlBean::Method::Factory, PerlBean::Style, PerlBean::Symbol
None known (yet.)
First development: December 2002 Last update: September 2003
Vincenzo Zocca
Copyright 2002, 2003 by Vincenzo Zocca
This file is part of the PerlBean module hierarchy for Perl by Vincenzo Zocca.
The PerlBean module hierarchy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
The PerlBean module hierarchy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the PerlBean module hierarchy; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To install PerlBean, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PerlBean
CPAN shell
perl -MCPAN -e shell install PerlBean
For more information on module installation, please visit the detailed CPAN module installation guide.