[90] | 1 | #!/usr/bin/perl -w |
---|
[1] | 2 | use strict; |
---|
| 3 | use warnings; |
---|
| 4 | |
---|
| 5 | use Getopt::Long; |
---|
| 6 | use Text::FormBuilder; |
---|
| 7 | |
---|
| 8 | GetOptions( |
---|
| 9 | 'o=s' => \my $outfile, |
---|
| 10 | 'D=s' => \my %fb_options, |
---|
| 11 | ); |
---|
| 12 | my $src_file = shift; |
---|
| 13 | |
---|
[52] | 14 | create_form($src_file, \%fb_options, $outfile); |
---|
| 15 | #Text::FormBuilder->parse($src_file)->build(%fb_options)->write($outfile); |
---|
[1] | 16 | |
---|
| 17 | =head1 NAME |
---|
| 18 | |
---|
| 19 | fb - 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 | |
---|
[52] | 27 | =head1 DESCRIPTION |
---|
| 28 | |
---|
| 29 | Parses a formspec file from the command line and creates an output |
---|
| 30 | file. The sort of output file depends on the value given to the C<-o> |
---|
| 31 | option. If it ends in F<.pm>, a standalone module is created. If it |
---|
| 32 | ends in F<.pl> or F<.cgi>, a skeleton CGI script is created. Any other |
---|
| 33 | value, will be taken as the name of an HTML file to write. Finally, if |
---|
| 34 | not C<-o> option is given then the HTML will be written to STDOUT. |
---|
| 35 | |
---|
[1] | 36 | =head1 OPTIONS |
---|
| 37 | |
---|
| 38 | =over |
---|
| 39 | |
---|
[52] | 40 | =item C<< -D <parameter>=<value> >> |
---|
[1] | 41 | |
---|
| 42 | Define options that are passed to the CGI::FormBuilder object. For example, |
---|
| 43 | to create a form on a static html page, and have it submitted to an external |
---|
| 44 | CGI script, you would want to define the C<action> parameter: |
---|
| 45 | |
---|
| 46 | $ fb ... -D action=/cgi-bin/some_script.pl |
---|
| 47 | |
---|
[52] | 48 | =item C<< -o <output file> >> |
---|
| 49 | |
---|
| 50 | Where to write output, and what form to write it in. See C<create_form> in |
---|
| 51 | L<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 |
---|
[53] | 58 | $ fb myform -o form.pl |
---|
[52] | 59 | |
---|
| 60 | =back |
---|
| 61 | |
---|
| 62 | =head1 AUTHOR |
---|
| 63 | |
---|
| 64 | Peter Eichman, C<< <peichman@cpan.org> >> |
---|
| 65 | |
---|
| 66 | =head1 COPYRIGHT AND LICENSE |
---|
| 67 | |
---|
| 68 | Copyright E<copy>2004 by Peter Eichman. |
---|
| 69 | |
---|
| 70 | This program is free software; you can redistribute it and/or |
---|
| 71 | modify it under the same terms as Perl itself. |
---|
| 72 | |
---|
| 73 | =cut |
---|