23c23 < package Data::FormValidator; --- > package Data::FormValidator::Enhanced; 463a464,472 > #!#################################################################### > my %alternates; > # get list of alternates > while ( my ( $field, $deps) = each %{$profile->{alternates}} ) { > foreach my $dep (_arrayify($deps)){ > $alternates{$dep} = 1; > } > } > ###################################################################### 519a529 > #!#################################################################### 522c532 < grep { not (exists $optional{$_} or exists $required{$_} ) } keys %valid; --- > grep { not (exists $optional{$_} or exists $required{$_} or exists $alternates{$_} ) } keys %valid; 526a537 > ###################################################################### 536a548,558 > > #!#################################################################### > # Check for the absence of alternate fields > while ( my ( $field, $deps) = each %{$profile->{alternates}} ) { > my $valid_alternate = 0; > foreach my $dep (_arrayify($deps)){ > $valid_alternate = 1 if exists $valid{$dep}; > } > push @missings, $field unless $valid_alternate; > } > ######################################################################