Array-GroupBy
view release on metacpan or search on metacpan
lib/Array/GroupBy.pm view on Meta::CPAN
args => [ 0, 1 ],
);
while (my $subset = $iter->()) {
my @visits = map { Visit->new(
date => $_[2],
doctor => $_[3],
diagnosis => $_[4],
)
} @$subset;
push @result, Patient->new(
last => $subset->[0]->[0],
first => $subset->[0]->[1],
Visit => \@visits,
);
}
See C<t/6.t> for code.
=head1 DIAGNOSTICS
Most error diagnostics are generated by the C<Params::Validate> module
which C<igroup_by()> uses for argument validation.
The C<data =E<gt> ...> and C<compare =E<gt> ...> parameters are mandatory.
Omitting one will generate error message:
Mandatory parameter '<data or compare>' missing in call to
Array::GroupBy::igroup_by
Similarly, using a parameter not in the list ( "data", "compare", "args" ),
e.g., typo C<compaer =E<gt> ...>, will generate error:
The following parameter was passed in the call to Array::GroupBy::igroup_by
but was not listed in the validation options: compaer
If the argument to the C<compare =E<gt> ...> parameter is not a subroutine reference,
e.g., C<compare =E<gt> 'my_sub'>, this will generate error:
The 'compare' parameter ("my_sub") to Array::GroupBy::igroup_by was a
'scalar', which is not one of the allowed types: coderef
If any of values of the parameters are undefined, this will generate error:
The '<data|compare|args>' parameter (undef) to Array::GroupBy::igroup_by
was an 'undef', which is not one of the allowed types: ...
Passing an empty data array, e.g., C<data =E<gt> []>, will result in error:
The array passed to igroup_by( data => ... ) is empty,
called at <program name> line <nnn>.
=head1 DEPENDENCIES
Carp
Params::Validate
List::Util
=head1 BUGS AND LIMITATIONS
No bugs have been reported (yet).
Please report any bugs or feature requests to
C<bug-array-groupby@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Sam Brain C<< <samb@stanford.edu> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2012, Sam Brain C<< <samb@stanford.edu> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
=cut
##### SUBROUTINE INDEX #####
# #
# gen by index_subs.pl #
# on 25 Jun 2012 10:59 #
# #
############################
####### Packages ###########
# Array::GroupBy ................ 1
# igroup_by ................... 1
# num_row_equal ............... 1
# str_row_equal ............... 1
( run in 2.517 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )