Data-MultiValuedHash

 view release on metacpan or  search on metacpan

t/Data-MultiValuedHash.t  view on Meta::CPAN

			type => 'textfield',
			name => 'name',
		}, {
			visible_title => "What's the combination?",
			type => 'checkbox_group',
			name => 'words',
			'values' => ['eenie', 'meenie', 'minie', 'moe'],
			default => ['eenie', 'minie'],
		}, {
			visible_title => "What's your favorite colour?",
			type => 'popup_menu',
			name => 'color',
			'values' => ['red', 'green', 'blue', 'chartreuse'],
		}, {
			type => 'submit', 
		},	
	);
	result( @sources == 9, "there are @{[scalar(@sources)]} source records" );

	my @mvh_list = Data::MultiValuedHash->batch_new( 0, \@sources );
	result( @mvh_list == 9, "there are @{[scalar(@mvh_list)]} new objects" );
	
	my @expected = (
		"{ }, ",
		"{ }, ",
		"{ }, ",
		"{ 'name' => [ 'Don Smith', ], }, ",
		"{ 'age' => [ '17', ], 'color' => [ 'green', ], 'name' => [ 'John', ], 'pets' => [ 'Cat', 'Bird', ], 'siblings' => [ 'Laura', 'Andrew', 'Julia', ], }, ",
		"{ 'name' => [ 'name', ], 'type' => [ 'textfield', ], 'visible_title' => [ 'What's your name?', ], }, ",
		"{ 'default' => [ 'eenie', 'minie', ], 'name' => [ 'words', ], 'type' => [ 'checkbox_group', ], 'values' => [ 'eenie', 'meenie', 'minie', 'moe', ], 'visible_title' => [ 'What's the combination?', ], }, ",
		"{ 'name' => [ 'color', ], 'type' => [ 'popup_menu', ], 'values' => [ 'red', 'green', 'blue', 'chartreuse', ], 'visible_title' => [ 'What's your favorite colour?', ], }, ",
		"{ 'type' => [ 'submit', ], }, ",
	);

	foreach my $i (0..$#mvh_list) {
		$mvh = $mvh_list[$i];
		
		$did = UNIVERSAL::isa( $mvh, "Data::MultiValuedHash" );
		result( $did, "new object $i is an MVH object" );

		if( $did ) {



( run in 2.473 seconds using v1.01-cache-2.11-cpan-364913b4093 )