GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  VALIDATION::CLASS::MAPPING (3)

.ds Aq ’

NAME

Validation::Class::Mapping - Generic Container Class for a Hash Reference

CONTENTS

VERSION

version 7.900056

SYNOPSIS



    use Validation::Class::Mapping;

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

    $foos->add(foo => one foo);
    $foos->add(bar => one bar);

    print $foos->count; # 2 objects



DESCRIPTION

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

METHODS

    new



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



    add



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



    clear



    $self = $self->clear;



    count



    my $count = $self->count;



    delete



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



    defined



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



    each



    $self = $self->each(sub{

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

    });



    exists



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



    get



    my $value = $self->get($name); # i.e. $self->{$name}



    grep



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



    has



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



    hash



    my $hash = $self->hash;



    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 (value)
    }



    keys



    my @keys = $self->keys;



    list



    my %hash = $self->list;



    merge



    $self->merge($hashref);



    nsort



    my @keys = $self->nsort;



    pairs



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

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



    rmerge



    $self->rmerge($hashref);



    rnsort



    my @keys = $self->rnsort;



    rsort



    my @keys = $self->rsort;



    sort



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



    values



    my @values = $self->values;



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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 VALIDATION::CLASS::MAPPING (3) 2014-05-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.