sub set_fields { my $self = shift; my %fields = @_; my $form = $self->current_form or $self->die( 'No form defined' ); while ( my ( $field, $value ) = each %fields ) { if ( ref $value eq 'ARRAY' ) { $form->find_input( $field, undef, $value->[1])->value($value->[0] ); } else { $form->value($field => $value); } } # while } # set_fields()