Index: trunk/Changes
===================================================================
--- trunk/Changes	(revision 50)
+++ trunk/Changes	(revision 52)
@@ -1,4 +1,8 @@
 Release history for Text::FormBuilder.
 
+0.08
+    * failure to load Perl::Tidy is no longer fatal
+    * create_form tries to emit tidy code
+    
 0.07 - 16 Dec 2004
     * added a create_form exported method to "do the right
Index: trunk/bin/fb.pl
===================================================================
--- trunk/bin/fb.pl	(revision 50)
+++ trunk/bin/fb.pl	(revision 52)
@@ -11,5 +11,6 @@
 my $src_file = shift;
 
-Text::FormBuilder->parse($src_file)->build(%fb_options)->write($outfile);
+create_form($src_file, \%fb_options, $outfile);
+#Text::FormBuilder->parse($src_file)->build(%fb_options)->write($outfile);
 
 =head1 NAME
@@ -23,9 +24,18 @@
     $ fb my_form.txt -o my_form.html -D action=/cgi-bin/my-script.pl
 
+=head1 DESCRIPTION
+
+Parses a formspec file from the command line and creates an output
+file. The sort of output file depends on the value given to the C<-o>
+option. If it ends in F<.pm>, a standalone module is created. If it
+ends in F<.pl> or F<.cgi>, a skeleton CGI script is created. Any other
+value, will be taken as the name of an HTML file to write. Finally, if
+not C<-o> option is given then the HTML will be written to STDOUT.
+
 =head1 OPTIONS
 
 =over
 
-=item -D <parameter>=<value>
+=item C<< -D <parameter>=<value> >>
 
 Define options that are passed to the CGI::FormBuilder object. For example,
@@ -35,3 +45,27 @@
     $ fb ... -D action=/cgi-bin/some_script.pl
 
-=item -o <output file>
+=item C<< -o <output file> >>
+
+Where to write output, and what form to write it in. See C<create_form> in 
+L<Text::FormBuilder> for a more detailed explanation.
+
+    # write a standalone module
+    $ fb myform -o MyForm.pm
+    
+    # write a CGI script
+    $ fb myform -o form.cgi
+
+=back
+
+=head1 AUTHOR
+
+Peter Eichman, C<< <peichman@cpan.org> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright E<copy>2004 by Peter Eichman.
+
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=cut
Index: trunk/lib/Text/FormBuilder.pm
===================================================================
--- trunk/lib/Text/FormBuilder.pm	(revision 50)
+++ trunk/lib/Text/FormBuilder.pm	(revision 52)
@@ -7,5 +7,5 @@
 use vars qw($VERSION @EXPORT);
 
-$VERSION = '0.07';
+$VERSION = '0.08_01';
 @EXPORT = qw(create_form);
 
@@ -64,7 +64,7 @@
             # write webpage, script, or module
             if ($destination =~ $MODULE_EXTS) {
-                $parser->write_module($destination);
+                $parser->write_module($destination, 1);
             } elsif ($destination =~ $SCRIPT_EXTS) {
-                $parser->write_script($destination);
+                $parser->write_script($destination, 1);
             } else {
                 $parser->write($destination);
@@ -439,4 +439,8 @@
     croak '[Text::FormBuilder::write_module] Expecting a package name' unless $package;
     
+    # remove a trailing .pm
+    $package =~ s/\.pm$//;
+##     warn  "[Text::FromBuilder::write_module] Removed extra '.pm' from package name\n" if $package =~ s/\.pm$//;
+    
     my $form_code = $self->_form_code;
     
@@ -499,6 +503,13 @@
         # clean up the generated code, if asked
         eval 'use Perl::Tidy';
-        die "Can't tidy the code: $@" if $@;
-        Perl::Tidy::perltidy(source => \$source_code, destination => $outfile, argv => $TIDY_OPTIONS);
+        unless ($@) {
+            Perl::Tidy::perltidy(source => \$source_code, destination => $outfile, argv => $TIDY_OPTIONS);
+        } else {
+            carp "Can't tidy the code: $@" if $@;
+            # fallback to just writing it as-is
+            open OUT, "> $outfile" or die $!;
+            print OUT $source_code;
+            close OUT;
+        }
     } else {
         # otherwise, just print as is
@@ -1194,6 +1205,23 @@
 =head1 TODO
 
+Improve the commmand line tools
+
 Allow renaming of the submit button; allow renaming and inclusion of a 
 reset button
+
+Allow groups to be used in normal field lines something like this:
+
+    !group DATE {
+        month
+        day
+        year
+    }
+    
+    dob|Your birthday:DATE
+
+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.
+
+Make the generated modules into subclasses of CGI::FormBuilder
 
 Allow for custom wrappers around the C<form_template>
