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

NAME

DBIx::Class::AccessorGroup - Lets you build groups of accessors

SYNOPSIS

DESCRIPTION

This class lets you build groups of accessors that will call different getters and setters.

METHODS

mk_group_accessors

Creates a set of accessors in a given group.

Arguments: $group, @fieldspec

$group is the name of the accessor group for the generated accessors; they will call get_$group($field) on get and set_$group($field, $value) on set.

@fieldspec is a list of field/accessor names; if a fieldspec is a scalar this is used as both field and accessor name, if a listref it is expected to be of the form [ $accessor, $field ].

Return value: none

mk_group_ro_accessors

Creates a set of read only accessors in a given group. Identical to <L:/mk_group_accessors> but accessors will throw an error if passed a value rather than setting the value.

Arguments: $group, @fieldspec

Return value: none

mk_group_wo_accessors

Creates a set of write only accessors in a given group. Identical to <L:/mk_group_accessors> but accessors will throw an error if not passed a value rather than getting the value.

Arguments: $group, @fieldspec

Return value: none

make_group_accessor

Returns a single accessor in a given group; called by mk_group_accessors for each entry in @fieldspec.

Arguments: $group, $field

Return value: $sub (\CODE)

make_group_ro_accessor

Returns a single read-only accessor in a given group; called by mk_group_ro_accessors for each entry in @fieldspec.

Arguments: $group, $field

Return value: $sub (\CODE)

make_group_wo_accessor

Returns a single write-only accessor in a given group; called by mk_group_wo_accessors for each entry in @fieldspec.

Arguments: $group, $field

Return value: $sub (\CODE)

get_simple

Simple getter for hash-based objects which returns the value for the field name passed as an argument.

Arguments: $field

Return value: $value

set_simple

Simple setter for hash-based objects which sets and then returns the value for the field name passed as an argument.

Arguments: $field, $new_value

Return value: $new_value

get_component_class

Returns the class name for a component; returns an object key if called on an object, or attempts to return classdata referenced by _$name if called on a class.

Arguments: $name

Return value: $component_class

set_component_class

Sets a component class name; attempts to require the class before setting but does not error if unable to do so. Sets an object key of the given name if called or an object or classdata called _$name if called on a class.

Arguments: $name, $new_component_class

Return value: $new_component_class

AUTHORS

Matt S. Trout <mst@shadowcatsystems.co.uk>

LICENSE

You may distribute this code under the same terms as Perl itself.