Form-Toolkit

 view release on metacpan or  search on metacpan

lib/Form/Toolkit/KVPairs/Pure.pm  view on Meta::CPAN


 my $set = Form::Toolkit::KVPairs::Pure
             ->new({ array => [ { 1 => 'One'},
                                { 2 => 'Two'},
                                 ...
                              ]});


=cut

has 'array' => ( is => 'ro' , isa => 'ArrayRef[HashRef]' , required => 1);

## Internal stuff
has '_index' => ( is => 'ro' , isa => 'HashRef[Defined]' , lazy_build => 1 );
has '_it' => ( is => 'rw' , isa => 'Int' , clearer => '_clear_it' );

sub _build__index{
  my ($self) = @_;

  my $idx = {};
  foreach my $kv ( @{$self->array()} ){
    my @kv = %$kv;
    if( $idx->{$kv[0]}){
      confess("Key ".$kv[0]." is repeated in your key value pairs");



( run in 0.599 second using v1.01-cache-2.11-cpan-5f2e87ce722 )