source: text-formbuilder/trunk/bin/fb.pl @ 92

Last change on this file since 92 was 90, checked in by peichman, 17 years ago
  • documentation patch from Ron Pero
  • added shebang line to the fb.pl script
  • added documentation about field hints
  • upped version to 0.13
  • changed all line endings in FormBuilder.pm to be unix-style
File size: 1.8 KB
Line 
1#!/usr/bin/perl -w
2use strict;
3use warnings;
4
5use Getopt::Long;
6use Text::FormBuilder;
7
8GetOptions(
9    'o=s' => \my $outfile,
10    'D=s' => \my %fb_options,
11);
12my $src_file = shift;
13
14create_form($src_file, \%fb_options, $outfile);
15#Text::FormBuilder->parse($src_file)->build(%fb_options)->write($outfile);
16
17=head1 NAME
18
19fb - Frontend script for Text::FormBuilder
20
21=head1 SYNOPSIS
22
23    $ fb my_form.txt -o form.html
24   
25    $ fb my_form.txt -o my_form.html -D action=/cgi-bin/my-script.pl
26
27=head1 DESCRIPTION
28
29Parses a formspec file from the command line and creates an output
30file. The sort of output file depends on the value given to the C<-o>
31option. If it ends in F<.pm>, a standalone module is created. If it
32ends in F<.pl> or F<.cgi>, a skeleton CGI script is created. Any other
33value, will be taken as the name of an HTML file to write. Finally, if
34not C<-o> option is given then the HTML will be written to STDOUT.
35
36=head1 OPTIONS
37
38=over
39
40=item C<< -D <parameter>=<value> >>
41
42Define options that are passed to the CGI::FormBuilder object. For example,
43to create a form on a static html page, and have it submitted to an external
44CGI script, you would want to define the C<action> parameter:
45
46    $ fb ... -D action=/cgi-bin/some_script.pl
47
48=item C<< -o <output file> >>
49
50Where to write output, and what form to write it in. See C<create_form> in
51L<Text::FormBuilder> for a more detailed explanation.
52
53    # write a standalone module
54    $ fb myform -o MyForm.pm
55   
56    # write a CGI script
57    $ fb myform -o form.cgi
58    $ fb myform -o form.pl
59
60=back
61
62=head1 AUTHOR
63
64Peter Eichman, C<< <peichman@cpan.org> >>
65
66=head1 COPYRIGHT AND LICENSE
67
68Copyright E<copy>2004 by Peter Eichman.
69
70This program is free software; you can redistribute it and/or
71modify it under the same terms as Perl itself.
72
73=cut
Note: See TracBrowser for help on using the repository browser.