Provided by: libvalidation-class-perl_7.900059-1_all bug

NAME

       Validation::Class::Listing - Generic Container Class for an Array Reference

VERSION

       version 7.900059

SYNOPSIS

           use Validation::Class::Listing;

           my $foos = Validation::Class::Listing->new;

           $foos->add('foo');
           $foos->add('bar', 'baz');

           print $foos->count; # 3 objects

DESCRIPTION

       Validation::Class::Listing is a container class that provides general-purpose
       functionality for arrayref objects.

METHODS

   new
           my $self = Validation::Class::Listing->new;

   add
           $self = $self->add('foo', 'bar');

   clear
           $self = $self->clear;

   count
           my $count = $self->count;

   delete
           $value = $self->delete($index);

   defined
           $true if $self->defined($name) # defined

   each
           $self = $self->each(sub{

               my ($index, $value) = @_;

           });

   first
           my $value = $self->first;

   get
           my $value = $self->get($index); # i.e. $self->[$index]

   grep
           $new_list = $self->grep(qr/update_/);

   has
           $true if $self->has($name) # defined

   iterator
           my $next = $self->iterator();

           # defaults to iterating by keys but accepts sort, rsort, nsort, or rnsort
           # e.g. $self->iterator('sort', sub{ (shift) cmp (shift) });

           while (my $item = $next->()) {
               # do something with $item
           }

   join
           my $string = $self->join($delimiter);

   last
           my $value = $self->last;

   list
           my @list = $self->list;

   nsort
           my @list = $self->nsort;

   pairs
           my @pairs = $self->pairs;
           # or filter using $self->pairs('grep', $regexp);

           foreach my $pair (@pairs) {
               # $pair->{index} is $pair->{value};
           }

   rnsort
           my @list = $self->rnsort;

   rsort
           my @list = $self->rsort;

   sort
           my @list = $self->sort(sub{...});

   unique
           my @list = $self->unique();

AUTHOR

       Al Newkirk <anewkirk@ana.io>

COPYRIGHT AND LICENSE

       This software is copyright (c) 2011 by Al Newkirk.

       This is free software; you can redistribute it and/or modify it under the same terms as
       the Perl 5 programming language system itself.