Changeset 88 in text-formbuilder for trunk/lib


Ignore:
Timestamp:
06/29/05 16:46:56 (19 years ago)
Author:
peichman
Message:

BUGFIX: stopped crosstalk of data from one object to another (references were getting shared in the parser grammar code)

Location:
trunk/lib/Text
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Text/FormBuilder.pm

    r87 r88  
    198198                push @{ $self->{form_spec}{fields} }, { %{$_} } foreach @{ $$line[1]{group} }; 
    199199            } elsif ($$line[0] eq 'field') { 
     200                #die $$line[1] unless ref $$line[1]; 
    200201                push @{ $self->{form_spec}{fields} }, { %{$$line[1]} }; 
    201202            } 
     
    13491350=head2 Language/Parser 
    13501351 
    1351 Make sure that multiple runs of the parser don't share data. 
    1352  
    13531352Pieces that wouldn't make sense in a group field: size, row/col, options, 
    13541353validate. These should cause C<build> to emit a warning before ignoring them. 
     
    13701369 
    13711370=head1 BUGS 
    1372  
    1373 Creating two $parsers in the same script causes the second one to get the data 
    1374 from the first one. 
    13751371 
    13761372Placing C<fields> in a C<!fb> directive does not behave as expected (i.e. they 
  • trunk/lib/Text/FormBuilder/grammar

    r87 r88  
    3737 
    3838form_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 = (); 
    4144    } 
    4245    (list_def | description_def | group_def | note | fb_params | unknown_block_directive | line)(s) 
     
    5255        } 
    5356         
     57        # make copies instead of taking references, again so we 
     58        # don't end up with connections between objects 
    5459        $return = { 
    5560            fb_params   => $formspec{fb_params}, 
     
    5762            author      => $formspec{author}, 
    5863            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 ]) : () ), 
    6870            reset       => $formspec{reset}, 
    6971        } 
     
    233235        @options = (); 
    234236         
     237        #warn "$$field{name}: $field"; 
     238         
    235239        $field; 
    236240    } 
Note: See TracChangeset for help on using the changeset viewer.