From: Peter Rabbitson Date: Mon, 28 Nov 2011 17:33:28 +0000 (+0100) Subject: Extend and clarify POD of various methods X-Git-Tag: v0.10004~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e0a387bafc5e6611c5a23e0792054ee48fa44bd;p=p5sagit%2FClass-Accessor-Grouped.git Extend and clarify POD of various methods --- diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index 2cfabc2..d66e4d6 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -97,7 +97,7 @@ getters and setters. =head2 mk_group_accessors - __PACKAGE__->mk_group_accessors(simple => 'hair_length'); + __PACKAGE__->mk_group_accessors(simple => 'hair_length', [ hair_color => 'hc' ]); =over 4 @@ -131,7 +131,7 @@ sub mk_group_accessors { =head2 mk_group_ro_accessors - __PACKAGE__->mk_group_ro_accessors(simple => 'birthdate'); + __PACKAGE__->mk_group_ro_accessors(simple => 'birthdate', [ social_security_number => 'ssn' ]); =over 4 @@ -155,7 +155,7 @@ sub mk_group_ro_accessors { =head2 mk_group_wo_accessors - __PACKAGE__->mk_group_wo_accessors(simple => 'lie'); + __PACKAGE__->mk_group_wo_accessors(simple => 'lie', [ subject => 'subj' ]); =over 4 @@ -177,66 +177,6 @@ sub mk_group_wo_accessors { $self->_mk_group_accessors('make_group_wo_accessor', $group, @fields); } -=head2 make_group_accessor - - __PACKAGE__->make_group_accessor(simple => 'hair_length', 'hair_length'); - -=over 4 - -=item Arguments: $group, $field, $method - -Returns: \&accessor_coderef ? - -=back - -Called by mk_group_accessors for each entry in @fieldspec. Either returns -a coderef which will be installed at C<&__PACKAGE__::$method>, or returns -C if it elects to install the coderef on its own. - -=cut - -sub make_group_accessor { $gen_accessor->('rw', @_) } - -=head2 make_group_ro_accessor - - __PACKAGE__->make_group_ro_accessor(simple => 'birthdate', 'birthdate'); - -=over 4 - -=item Arguments: $group, $field, $method - -Returns: \&accessor_coderef ? - -=back - -Called by mk_group_ro_accessors for each entry in @fieldspec. Either returns -a coderef which will be installed at C<&__PACKAGE__::$method>, or returns -C if it elects to install the coderef on its own. - -=cut - -sub make_group_ro_accessor { $gen_accessor->('ro', @_) } - -=head2 make_group_wo_accessor - - __PACKAGE__->make_group_wo_accessor(simple => 'lie', 'lie'); - -=over 4 - -=item Arguments: $group, $field, $method - -Returns: \&accessor_coderef ? - -=back - -Called by mk_group_wo_accessors for each entry in @fieldspec. Either returns -a coderef which will be installed at C<&__PACKAGE__::$method>, or returns -C if it elects to install the coderef on its own. - -=cut - -sub make_group_wo_accessor { $gen_accessor->('wo', @_) } - =head2 get_simple =over 4 @@ -422,9 +362,15 @@ sub set_component_class { return $_[0]->set_inherited($_[1], $_[2]); }; +=head1 INTERNAL METHODS + +These methods are documented for clarity, but are never meant to be called +directly, and are not really meant for overriding either. + =head2 get_super_paths -Returns a list of 'parent' or 'super' class names that the current class inherited from. +Returns a list of 'parent' or 'super' class names that the current class +inherited from. This is what drives the traversal done by L. =cut @@ -432,6 +378,70 @@ sub get_super_paths { return @{mro::get_linear_isa( ref($_[0]) || $_[0] )}; }; +=head2 make_group_accessor + + __PACKAGE__->make_group_accessor('simple', 'hair_length', 'hair_length'); + __PACKAGE__->make_group_accessor('simple', 'hc', 'hair_color'); + +=over 4 + +=item Arguments: $group, $field, $accessor + +Returns: \&accessor_coderef ? + +=back + +Called by mk_group_accessors for each entry in @fieldspec. Either returns +a coderef which will be installed at C<&__PACKAGE__::$accessor>, or returns +C if it elects to install the coderef on its own. + +=cut + +sub make_group_accessor { $gen_accessor->('rw', @_) } + +=head2 make_group_ro_accessor + + __PACKAGE__->make_group_ro_accessor('simple', 'birthdate', 'birthdate'); + __PACKAGE__->make_group_ro_accessor('simple', 'ssn', 'social_security_number'); + +=over 4 + +=item Arguments: $group, $field, $accessor + +Returns: \&accessor_coderef ? + +=back + +Called by mk_group_ro_accessors for each entry in @fieldspec. Either returns +a coderef which will be installed at C<&__PACKAGE__::$accessor>, or returns +C if it elects to install the coderef on its own. + +=cut + +sub make_group_ro_accessor { $gen_accessor->('ro', @_) } + +=head2 make_group_wo_accessor + + __PACKAGE__->make_group_wo_accessor('simple', 'lie', 'lie'); + __PACKAGE__->make_group_wo_accessor('simple', 'subj', 'subject'); + +=over 4 + +=item Arguments: $group, $field, $accessor + +Returns: \&accessor_coderef ? + +=back + +Called by mk_group_wo_accessors for each entry in @fieldspec. Either returns +a coderef which will be installed at C<&__PACKAGE__::$accessor>, or returns +C if it elects to install the coderef on its own. + +=cut + +sub make_group_wo_accessor { $gen_accessor->('wo', @_) } + + =head1 PERFORMANCE To provide total flexibility L calls methods diff --git a/t/pod_spelling.t b/t/pod_spelling.t index a01c909..3137038 100644 --- a/t/pod_spelling.t +++ b/t/pod_spelling.t @@ -44,3 +44,8 @@ CAF Sep XSA runtime +Axel +fREW +frew +getter +subclasses