Exodist::Util::Accessors - Tools for creating both ultra-minimal accessors, and highly specialized accessors.
Use the minimal if you don't need anything fancy and don't want a Moose memory footprint. The highly specialsed are not covered by Moose and would likely be very verbose to define in Moose.
Create simple get/set accessors.
use Exodist::Util::Accessors qw/ accessors /; accessors qw/ accessor_a accessor_b my_thing /; ... $obj->my_thing( $newval ); $val = $obj->my_thing();
use Exodist::Util::Accessors qw/ array_accessors /; array_accessors qw/ my_stuff your_stuff /; ... $obj->push_my_stuff( @values ); @values = $obj->my_stuff();
The following methods will be created for each item:
Get/set the reference to the array.
Get the elements of the array
Add an item to the end of the array
Removes the last item of the array.
Add an item to the start of the array
Removes the first item of the array.
Clears the values from the object
A Category accessor is an accessor that acts like an array, but keeps elements seperated by type so that they cane be pulled out without a grep or loop.
use Exodist::Util::Accessors qw/ category_accessors /; category_accessors qw/ my_stuff your_stuff /; ... $obj->push_my_stuff( @values ); @values = $obj->my_stuff(); @subset = $obj->my_stuff( $type );
The following accessors will be created for each item:
Get/Set the reference storing the category lists.
Get a list of all the items.
Get a list of all items of a specific subclass.
Add an Item.
Remove all elements of a specific subclass, and return them.
Pulls the subset of values blessed as $blessed.
Get a list of categories.
Chad Granum email@example.com
Copyright (C) 2010 Chad Granum
Exodist-Util is free software; Standard perl licence.
Exodist-Util 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 license for more details.