The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Exodist::Util::Accessors - Tools for creating both ultra-minimal accessors, and highly specialized accessors.

DESCRIPTION

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.

EXPORTS

SIMPLE ACCESSOR GENERATOR

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();

ARRAY ACCESSORS AND MANIPULATORS

    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:

$arrayref = NAME_ref( $arrayref )

Get/set the reference to the array.

@list = NAME()

Get the elements of the array

push_NAME( $item )

Add an item to the end of the array

$item = pop_NAME()

Removes the last item of the array.

unshift_NAME( $item )

Add an item to the start of the array

$item = shift_NAME()

Removes the first item of the array.

@list = pull_NAME()

Clears the values from the object

CATEGORY ACCESSOR GENERATOR

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:

$hashref = NAME_ref( $hashref )

Get/Set the reference storing the category lists.

@list = NAME()

Get a list of all the items.

@sublist = NAME( $type )

Get a list of all items of a specific subclass.

push_NAME( $item )

Add an Item.

@list = pull_all_NAME()

Remove all elements of a specific subclass, and return them.

@list = pull_NAME( $blessed )

Pulls the subset of values blessed as $blessed.

@types = keys_NAME();

Get a list of categories.

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

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.