Index: /trunk/Changes
===================================================================
--- /trunk/Changes	(revision 87)
+++ /trunk/Changes	(revision 88)
@@ -2,4 +2,5 @@
 
 0.12
+    * BUGFIX: stopped crosstalk of data from one object to another
     * added !fb directive to set FB constructor parameters directly;
       uses YAML to hold strucutred data
Index: /trunk/lib/Text/FormBuilder.pm
===================================================================
--- /trunk/lib/Text/FormBuilder.pm	(revision 87)
+++ /trunk/lib/Text/FormBuilder.pm	(revision 88)
@@ -198,4 +198,5 @@
                 push @{ $self->{form_spec}{fields} }, { %{$_} } foreach @{ $$line[1]{group} };
             } elsif ($$line[0] eq 'field') {
+                #die $$line[1] unless ref $$line[1];
                 push @{ $self->{form_spec}{fields} }, { %{$$line[1]} };
             }
@@ -1349,6 +1350,4 @@
 =head2 Language/Parser
 
-Make sure that multiple runs of the parser don't share data.
-
 Pieces that wouldn't make sense in a group field: size, row/col, options,
 validate. These should cause C<build> to emit a warning before ignoring them.
@@ -1370,7 +1369,4 @@
 
 =head1 BUGS
-
-Creating two $parsers in the same script causes the second one to get the data
-from the first one.
 
 Placing C<fields> in a C<!fb> directive does not behave as expected (i.e. they
Index: /trunk/lib/Text/FormBuilder/grammar
===================================================================
--- /trunk/lib/Text/FormBuilder/grammar	(revision 87)
+++ /trunk/lib/Text/FormBuilder/grammar	(revision 88)
@@ -37,6 +37,9 @@
 
 form_spec:
-    { 
-	%formspec = ();  # clear the old formspec data
+    {
+	# clear out old data, so we don't end up with old data in new objects
+	@lines    = ();
+	@sections = ();
+	%formspec = ();
     }
     (list_def | description_def | group_def | note | fb_params | unknown_block_directive | line)(s)
@@ -52,4 +55,6 @@
 	}
 	
+	# make copies instead of taking references, again so we
+	# don't end up with connections between objects
 	$return = {
 	    fb_params   => $formspec{fb_params},
@@ -57,13 +62,10 @@
 	    author      => $formspec{author},
 	    description => $formspec{description},
-	    lists       => \%lists,
-	    patterns    => \%patterns,
-	    subs        => \%subs,
-	    groups      => \%groups,
-	    sections    => \@sections,
-	    ( @submit ? 
-		(submit => @submit == 1 ? $submit[0] : \@submit) :
-		()
-	    ),
+	    lists       => { %lists },
+	    patterns    => { %patterns },
+	    subs        => { %subs },
+	    groups      => { %groups },
+	    sections    => [ @sections ],
+	    ( @submit ? (submit => @submit == 1 ? $submit[0] : [ @submit ]) : () ),
 	    reset       => $formspec{reset},
 	}
@@ -233,4 +235,6 @@
 	@options = ();
 	
+	#warn "$$field{name}: $field";
+	
 	$field;
     }
Index: /trunk/t/Text-FormBuilder.t
===================================================================
--- /trunk/t/Text-FormBuilder.t	(revision 87)
+++ /trunk/t/Text-FormBuilder.t	(revision 88)
@@ -4,13 +4,6 @@
 #########################
 
-# change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test::More tests => 10;
+use Test::More qw(no_plan); #tests => 11;
 BEGIN { use_ok('Text::FormBuilder'); };
-
-#########################
-
-# Insert your test code below, the Test::More module is use()ed here so read
-# its man page ( perldoc Test::More ) for help writing this test script.
 
 my $p = Text::FormBuilder->new;
@@ -39,5 +32,8 @@
 is(keys %{ $form->fields }, 3, 'correct number of fields');
 
-my $p2 = Text::FormBuilder->parse_array([qw(code title semester instructor)]);
-is(keys %{ $p2->form->fields }, 4, 'correct number of fields from parse_array');
-#$p2->write;
+# create some additional parsers, to make sure we aren't sharing data
+my $p2 = Text::FormBuilder->parse_text($simple);
+is(keys %{ $p2->form->fields }, 3, 'correct number of fields from parse_text');
+
+my $p3 = Text::FormBuilder->parse_array(qw(code title semester instructor));
+is(keys %{ $p3->form->fields }, 4, 'correct number of fields from parse_array');
