- Timestamp:
- 12/15/04 16:49:51 (20 years ago)
- Location:
- trunk/lib/Text
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Text/FormBuilder.pm
r42 r46 7 7 use vars qw($VERSION @EXPORT); 8 8 9 $VERSION = '0.07_0 2';9 $VERSION = '0.07_03'; 10 10 @EXPORT = qw(create_form); 11 11 … … 48 48 49 49 my $HTML_EXTS = qr/\.html?$/; 50 my $MODULE_EXTS = qr/\.pm$/; 50 51 my $SCRIPT_EXTS = qr/\.(pl|cgi)$/; 51 52 … … 61 62 } else { 62 63 # write webpage, script, or module 63 if ($destination =~ $ HTML_EXTS) {64 $parser->write ($destination);64 if ($destination =~ $MODULE_EXTS) { 65 $parser->write_module($destination); 65 66 } elsif ($destination =~ $SCRIPT_EXTS) { 66 67 $parser->write_script($destination); 67 68 } else { 68 $parser->write _module($destination);69 $parser->write($destination); 69 70 } 70 71 } … … 686 687 karate, and bass guitar. 687 688 689 =head1 METHODS 690 688 691 =head2 new 689 692 … … 886 889 Uses L<YAML> to print out a human-readable representation of the parsed 887 890 form spec. 891 892 =head1 EXPORTS 893 894 There is one exported function, C<create_form>, that is intended to ``do the 895 right thing'' in simple cases. 896 897 =head2 create_form 898 899 # get a CGI::FormBuilder object 900 my $form = create_form($source, $options, $destination); 901 902 # or just write the form immediately 903 create_form($source, $options, $destination); 904 905 C<$source> accepts any of the types of arguments that C<parse> does. C<$options> 906 is a hashref of options that should be passed to C<build>. Finally, C<$destination> 907 is a simple scalar that determines where and what type of output C<create_form> 908 should generate. 909 910 /\.pm$/ ->write_module($destination) 911 /\.(cgi|pl)$/ ->write_script($destination) 912 everything else ->write($destination) 913 914 For anything more than simple, one-off cases, you are usually better off using the 915 object-oriented interface, since that gives you more control over things. 888 916 889 917 =head1 DEFAULTS … … 1151 1179 (since CGI::FormBuilder users may be more likely to already have HTML::Template) 1152 1180 1153 Better examples in the docs (maybe a standalone or two as well)1154 1155 1181 C<!include> directive to include external formspec files 1156 1182 … … 1161 1187 Creating two $parsers in the same script causes the second one to get the data 1162 1188 from the first one. 1163 1164 Get the fallback to CGI::FormBuilder builtin lists to work.1165 1189 1166 1190 I'm sure there are more in there, I just haven't tripped over any new ones lately. :-)
Note: See TracChangeset
for help on using the changeset viewer.