- Timestamp:
- 06/29/05 16:46:56 (19 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Changes
r87 r88 2 2 3 3 0.12 4 * BUGFIX: stopped crosstalk of data from one object to another 4 5 * added !fb directive to set FB constructor parameters directly; 5 6 uses YAML to hold strucutred data -
trunk/lib/Text/FormBuilder.pm
r87 r88 198 198 push @{ $self->{form_spec}{fields} }, { %{$_} } foreach @{ $$line[1]{group} }; 199 199 } elsif ($$line[0] eq 'field') { 200 #die $$line[1] unless ref $$line[1]; 200 201 push @{ $self->{form_spec}{fields} }, { %{$$line[1]} }; 201 202 } … … 1349 1350 =head2 Language/Parser 1350 1351 1351 Make sure that multiple runs of the parser don't share data.1352 1353 1352 Pieces that wouldn't make sense in a group field: size, row/col, options, 1354 1353 validate. These should cause C<build> to emit a warning before ignoring them. … … 1370 1369 1371 1370 =head1 BUGS 1372 1373 Creating two $parsers in the same script causes the second one to get the data1374 from the first one.1375 1371 1376 1372 Placing C<fields> in a C<!fb> directive does not behave as expected (i.e. they -
trunk/lib/Text/FormBuilder/grammar
r87 r88 37 37 38 38 form_spec: 39 { 40 %formspec = (); # clear the old formspec data 39 { 40 # clear out old data, so we don't end up with old data in new objects 41 @lines = (); 42 @sections = (); 43 %formspec = (); 41 44 } 42 45 (list_def | description_def | group_def | note | fb_params | unknown_block_directive | line)(s) … … 52 55 } 53 56 57 # make copies instead of taking references, again so we 58 # don't end up with connections between objects 54 59 $return = { 55 60 fb_params => $formspec{fb_params}, … … 57 62 author => $formspec{author}, 58 63 description => $formspec{description}, 59 lists => \%lists, 60 patterns => \%patterns, 61 subs => \%subs, 62 groups => \%groups, 63 sections => \@sections, 64 ( @submit ? 65 (submit => @submit == 1 ? $submit[0] : \@submit) : 66 () 67 ), 64 lists => { %lists }, 65 patterns => { %patterns }, 66 subs => { %subs }, 67 groups => { %groups }, 68 sections => [ @sections ], 69 ( @submit ? (submit => @submit == 1 ? $submit[0] : [ @submit ]) : () ), 68 70 reset => $formspec{reset}, 69 71 } … … 233 235 @options = (); 234 236 237 #warn "$$field{name}: $field"; 238 235 239 $field; 236 240 } -
trunk/t/Text-FormBuilder.t
r87 r88 4 4 ######################### 5 5 6 # change 'tests => 1' to 'tests => last_test_to_print'; 7 8 use Test::More tests => 10; 6 use Test::More qw(no_plan); #tests => 11; 9 7 BEGIN { use_ok('Text::FormBuilder'); }; 10 11 #########################12 13 # Insert your test code below, the Test::More module is use()ed here so read14 # its man page ( perldoc Test::More ) for help writing this test script.15 8 16 9 my $p = Text::FormBuilder->new; … … 39 32 is(keys %{ $form->fields }, 3, 'correct number of fields'); 40 33 41 my $p2 = Text::FormBuilder->parse_array([qw(code title semester instructor)]); 42 is(keys %{ $p2->form->fields }, 4, 'correct number of fields from parse_array'); 43 #$p2->write; 34 # create some additional parsers, to make sure we aren't sharing data 35 my $p2 = Text::FormBuilder->parse_text($simple); 36 is(keys %{ $p2->form->fields }, 3, 'correct number of fields from parse_text'); 37 38 my $p3 = Text::FormBuilder->parse_array(qw(code title semester instructor)); 39 is(keys %{ $p3->form->fields }, 4, 'correct number of fields from parse_array');
Note: See TracChangeset
for help on using the changeset viewer.