PaxHeader/CGI-FormBuilder-3.09000755 777777 000000 00000000173 12246253074 017160 xustar00natewarewheel000000 000000 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715655 19 SCHILY.nlink=10 CGI-FormBuilder-3.09/000755 €_$D000000 00000000000 12246253074 015222 5ustar00natewarewheel000000 000000 CGI-FormBuilder-3.09/PaxHeader/Changes000644 777777 000000 00000000172 12246253074 020524 xustar00natewarewheel000000 000000 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715834 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/Changes000644 €_$D000000 00000042524 12246253074 016524 0ustar00natewarewheel000000 000000 NAME Changes - Changes in FormBuilder 3.0, please also see the README COMPATIBILITY FormBuilder 3.x should be completely compatible with FormBuilder 2.x, with the singular exception that you can no longer use the shortcut autoload style of getting to fields: $form->field(name => 'category', options => \@opt); $form->category(options => \@opt); # WRONG In order to allow the second form, you must specify the "fieldsubs" option to "new()". VERSION 3.06 Maintenance release with a couple new features: support for "charset: utf8" in "Source::File", add_before_option/add_after_option c/o Victor Porton, and support for HTML5 type names c/o Wolfgang Radke. VERSION 3.0501 Bugfix release to repair a memory leak and a few "other" field edge cases. VERSION 3.05 Just a short time after 3.04, several new features evolved very quickly: Fieldset support A new "fieldsets" option to "new()" and a "fieldset" option to the "field()" method can be used to organize your form into sections. Currently works with the built-in "" and new "
" renderer only, but template support is in the works. Div rendering In addition to the builtin "
" rendering module, a new "Div" rendering template has been included as well. If you select this, you get a table-free form which you can manipulate using stylesheets: $form->new(template => {type => 'div'}); This provides a couple additional benefits, like separate divs for every submit button. Additional classes A couple additional CSS classes were added, wrapping around the fields as a unit for better styling. The "" tag now gets a ".fb_form" style as well. Fixed HTML::Template support A couple bugs were introduced in 3.04 that have been fixed, and more tests added. VERSION 3.04 In addition to the below features, a new Catalyst FormBuilder plugin is available on CPAN, "Catalyst::Plugin::FormBuilder". New $form->prepare() method You can now use "$form->prepare()" to get back an expanded hashref just before "$form->render()" is called. This allows you to use FormBuilder with Catalyst or other frameworks more easily, where the rendering is done elsewhere: my %expansion = $form->prepare; This could be passed directly to, say, Template Toolkit without having to use FormBuilder's Template Toolkit support. New "inflate" option to field() This is used the convert fields on the fly into objects or other values. For example, you could convert a "date" field into a DateTime object. Nice patch from Mark Hedges, check it out. Turkish messages Thanks to Recai Oktas. Added "missing" property for fields This can be queried in templates. To see if a field is missing altogether, you can check "field.missing" or "missing-field" depending on your template engine of choice. Removal of custom "puke" and "belch" FormBuilder now uses "Carp" and @CARP_NOT to handle its errors. As such, you will probably notice some differences in error output. The benefit is that setting "debug" will give you a stack trace on fatal errors. CGI::FormBuilder::Template::Builtin Moved the "render_builtin()" method to the above module, to unify the rendering schemes. New FORMBUILDER_DEBUG environment variable Setting this has the same effect as using the "debug" option. Removal of excess documentation Removed all the stub docs from "Field::*" and "Messages::*" to make CPAN happy. VERSION 3.0302 This is a bugfix release to repair these main items: - optgroups bugfix for complex arrays - removal of HTML::Entities support due to utf8 issues - new es_ES Messages module with better translations - a patch from Mark Hedges to enable plugin modules for mailresults() The rest of the features remain the same as below. VERSION 3.03 Subclassable Fields Each field is now rendered by its own class, named for the field type. For example, text fields are rendered by "CGI::FormBuilder::Field::text". This allows you to create custom field types and plugging them in by creating your own "CGI::FormBuilder::Field::whatever_you_want" module. Thanks to Peter Eichman for his contributions to this scheme. Messages Localization All messages are now handled in a similar way to field types: They are delegated to "CGI::FormBuilder::Messages::locale" where "locale" is the appropriate string such as "en_US" or "da_DK". A number of localizations are included as part of the standard distribution. There are two ways to use these messages: Either the 'auto' messages mode or by specifying a specific locale: my $form = CGI::FormBuilder->new(messages => 'auto'); # check client my $form = CGI::FormBuilder->new(messages => ':da_DK'); # specified You can create your own messages by copying "_example.pm" and modifying it for your language. When using messages in this way, the HTTP Charset is changed to "utf-8". Select optgroup support By using the "field()" option "optgroups", you can now cause select fields to automatically generate optgroup tags: $form->field(name => 'browser', options => \@opt, optgroups => 1); See the documentation on "optgroups" for more details. Data::FormValidator Support Thanks to another great patch from Peter Eichman, "Data::FormValidator" is supported as a validation option to "new()", just by passing it in as an object. See the documentation on "validate" for more information. Option sorting by LABELNAME or LABELNUM You can now sort options by "LABELNAME" or "LABELNUM", similar to the value-based sorting of "NAME" and "NUM". See the documentation for more details. XHTML Compliance Generated code now validates against . This includes stuff like lowercase "get" and "post" methods, lowercase "onchange" and "onsubmit" actions, and so on. VERSION 3.02 Multi-Page Form Support A new module, "CGI::FormBuilder::Multi", has been added to handle the navigation and state of multi-page forms. A multi-page form is actually composed of several individual forms, tied together with the special CGI param "_page": my $multi = CGI::FormBuilder::Multi->new( # first args are hashrefs per-form \%form1_opts, \%form2_opts, \%form3_opts, # remaining options apply to all forms header => 1, method => 'POST', ); my $form = $multi->form; # current form if ($form->submitted && $form->validate) { # you write this do_data_update($form->fields); # last page? if ($multi->page == $multi->pages) { print $form->confirm; exit; } $multi->page++; # next page counter $form = $multi->form; # fetch next page's form } print $form->render; For more details, see CGI::FormBuilder::Multi. External Source File Inspired by Peter Eichman's "Text::FormBuilder", the new "source" option has been added to "new()" which enables the use of an external config file to initialize FormBuilder. This file takes the format: # sample config file method: POST header: 1 submit: Update, Delete fields: fname: label: First Name size: 50 validate: NAME lname: label: Last Name size: 40 validate: NAME sex: label: Gender options: M=Male, F=Female jsclick: javascript:alert("Change your mind??"); validate: M,F required: ALL messages: form_invalid_text: Please correct the following fields: form_required_text: Please fill in all bold fields. You can even pre-parse this file, and generate a module from it which you can then reuse in multiple scripts using the "write_module()" function. For more details, see CGI::FormBuilder::Source::File. "Other" Fields The new "other" option has been added to "field()". If specified, a text box will be added to the right of the field, and its value will be used if the main field is not filled in. It will be subject to the same required and validation checks as the main field: $form->field(name => 'favorite_color', options => [qw(Red Green Blue)], validate => 'NAME', other => 1); # allow "other" This would create HTML something like this: Favorite Color: []Red []Green []Blue []Other: [____________] The text "Other:" is controlled by the message "form_other_default". Growable Fields Thanks to a patch from Peter Eichman, "field()" now also accepts a "growable" option. This option enables some JavaScript hooks that add an "Additional [label]" button on text and file fields: Data File: [______________] [Additional Data File] When you click on the "Additional Data File" button, another box will be appended, allowing you to add more files. The values are then retrieved in the usual fashion: my @files = $form->field('data_file'); Like "other" fields, all elements are subject to validation checks. The text "Additional %s" is controlled by the message "form_grow_default". Support for "CGI::FastTemplate" Thanks once again to Peter Eichman (busy guy), the module "CGI::FormBuilder::Template::Fast" has been included. This adds the template type "Fast" as an interface to "CGI::FastTemplate": my $form = CGI::FormBuilder->new( template => { type => 'Fast', define => { form => 'form.tmpl', field => 'field.tmpl', } } See CGI::FormBuilder::Template::Fast for more details. Thanks again Peter! Subclassable Templates and tmpl_param() The 2.x "tmpl_param()" method has been reimplemented finally. In addition, the included template modules are now completely subclassable, meaning that you can create an entire template engine with something like this: package My::HTML::Template; use CGI::FormBuilder::Template::HTML; use base 'CGI::FormBuilder::Template::HTML'; # new() is inherited sub render { my $self = shift; my $form = shift; # complete form object # do any special actions here $self->SUPER::render; } For more details, see CGI::FormBuilder::Template. Message Changes All messages were reworded to make them shorter and easier to read. The phrase "You must" was removed from all of them. To see the new messages, cut-and-paste this code: perl -MCGI::FormBuilder::Messages \ -e 'CGI::FormBuilder::Messages->messages' In addition, the "form_submit_default" and "form_reset_default" messages were not even being used, and field labels were not being properly highlighted on error. These problems have been fixed. Autoloaded Fields The 2.x feature of "$form->$fieldname()" has been reimplemented, but using it requires the "fieldsubs" option: my $form = CGI::FormBuilder->new(fields => \@f, fieldsubs => 1); Read the docs for some caveats. Disabled Form Similar to a static form, you can set "disabled => 1" in "new()" or "render()" to display a form with grayed-out input boxes. You can also set this on a per-field basis using "field()". Verbatim HTML Options If you want to include HTML in your field options, set "cleanopts" to 0 in "field()" (for one field) or "new()" (for all fields). Compatibility Methods For compatibility with other modules, FormBuilder now includes "param()", "query_string()", "self_url()", and "script_name()". VERSION 3.01 This was a bugfix release, including the following changes: - fixed major problems with keepextras, including a reversed ismember test - added debug messages to keepextras and changed a few other debugs - added patch from Peter Eichman to fix scalar $field->tag and $field->tag_value - converted most all XHTML generation methods to only returning scalars - fixed the columns option which was totally broken for radio buttons - added a feature to plop in {border => 0} in columns as well - added the 2.x 'override' alias for field() 'force' which was missing - also added a 'defaults' alias for field() 'value' for CGI.pm happiness - more tests since there were way too many bugs In addition there were many documentation updates and changes. VERSION 3.00 Internals The internals have been completely rewritten, nearly from the ground up. All of the major functions have been split into methods, and objects have been created for the form, fields, messages, CGI params, and so on. Several new sub-modules have been created, including: CGI::FormBuilder::Field CGI::FormBuilder::Messages CGI::FormBuilder::Template CGI::FormBuilder::Template::HTML CGI::FormBuilder::Template::Text CGI::FormBuilder::Template::TT2 Many of these modules can be subclassed and overridden if desired. In addition, the template engine has been rewritten to allow "plugging in" of additional template modules, simply by specifying the name of the module to the 'template' option in new(). For more details, see the man pages for the individual modules above. Style Sheets Stylesheets are now generated if the "stylesheet" option is specified to FormBuilder. This can either be 1 to turn it on, or a full path to a style sheet to include. When used, all tags are then output with a "class" attribute, named "styleclass" plus the name of the tag: my $form = CGI::FormBuilder->new( fields => [qw/name email/], styleclass => 'myFB', # default is "fb_" stylesheet => 1, # turn on style ); print $form->render; # HTML will include # # Compliant XHTML The output should be fully-compliant XHTML finally. Really. Maybe. Attributes and Field Objects Individual accessors have been added for every attribute that FormBuilder maintains. For example, here's a snippet of code to demonstrate: if ($form->stylesheet) { # loop thru fields, changing class for ($form->fields) { next if /_date$/; # skip fields named "XXX_date" # each field is a stringifiable object with accessors if ($_->options) { # has options $_->class('my_opt_style'); } else { # plain text box $_->class('my_text_style'); } } } This code checks to see if the "stylesheet" property has been set on the main $form. If so, then it loops thru all the fields, skipping those named "XXX_date". Of the remaining fields, those that have options have their "class" attribute changed to "my_opt_style", and those without options have it set to "my_text_style". In addition, you can individually render every part of the form yourself. by calling the appropriate method. For example: print $form->header; # just the header print $form->script; # opening JavaScript print $form->title; # form title print $form->start; # opening tag for ($form->fields) { print $_->label; # each field's human label print $_->tag; # each field's tag } print $form->end; # closing tag For a complete list of accessors, see the documentation for both CGI::FormBuilder and CGI::FormBuilder::Field. Messages Many messages have been reworded, and several new messages were added to make it easier to customize individual text. In addition, you can now specify messages to individual fields: $form->field(name => 'email', message => 'Please enter a valid email address'); For more details, see "CGI::FormBuilder::Messages". HTML::Entities encoding HTML character encoding is now dispatched to "HTML::Entities", if available. This can be downloaded as part of the "HTML::Parser" module set on CPAN. Documentation Documentation has been updated and somewhat reorganized, which was long overdue. AUTHOR Copyright (c) Nate Wiger . All Rights Reserved. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. CGI-FormBuilder-3.09/PaxHeader/INSTALL000644 777777 000000 00000000172 12246253074 020262 xustar00natewarewheel000000 000000 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715833 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/INSTALL000644 €_$D000000 00000001727 12246253074 016262 0ustar00natewarewheel000000 000000 NAME INSTALL - how to install FormBuilder 3.0 DESCRIPTION To install in your root Perl tree: perl Makefile.PL make make test make install If you want to relocate it elsewhere, say for testing, you need to change several "MakeMaker" variables: perl Makefile.PL PREFIX=~/lib \ INSTALLMAN1DIR=~/man/man1 \ INSTALLMAN3DIR=~/man/man3 \ INSTALLARCHLIB=~/lib \ INSTALLPRIVLIB=~/lib \ INSTALLSITELIB=~/lib \ INSTALLSITEARCH=~/lib Note: This is true for CPAN modules and is not specific to FormBuilder. AUTHOR Copyright (c) Nate Wiger . All Rights Reserved. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. CGI-FormBuilder-3.09/PaxHeader/lib000755 777777 777777 00000000214 12246225402 016741 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715657 18 SCHILY.nlink=3 CGI-FormBuilder-3.09/lib/000755 €_$D€q{Ì00000000000 12246225402 015330 5ustar00nateware000000 000000 CGI-FormBuilder-3.09/PaxHeader/Makefile.PL000644 777777 777777 00000000214 12246225402 020217 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715656 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/Makefile.PL000644 €_$D€q{Ì00000004165 12246225402 016542 0ustar00nateware000000 000000 use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. use vars qw($real); sub modcheck () { # check to see if our template modules are present, as they're optional my($failed, $ok) = ('',''); print "\nDoing FormBuilder pre-req checks...\n\n"; for ('HTML::Template 2.06 (for CGI::FormBuilder::Template::HTML)', 'Text::Template 1.43 (for CGI::FormBuilder::Template::Text)', 'Template 2.08 (for CGI::FormBuilder::Template::TT2)', 'CGI::FastTemplate 1.09 (for CGI::FormBuilder::Template::Fast)', 'CGI::SSI 0.92 (for CGI::FormBuilder::Template::CGI_SSI)', 'CGI::Session 3.95 (for CGI::FormBuilder::Multi)' ) { my($mod,$ver) = split; eval "use $mod $ver"; if ($@) { my($err) = split / at | \(/, $@; $failed .= sprintf " %-18s $ver (%s)\n", $mod, $err; } else { eval "require $mod; \$real = \$$mod\::VERSION"; (my $t = $_) =~ s/\d+\.\d+/sprintf "%-4s", $real/e; $ok .= " $t\n"; } } if ($ok) { print < 'CGI::FormBuilder', VERSION_FROM => 'lib/CGI/FormBuilder/Util.pm', # finds $VERSION PREREQ_PM => { CGI => 0 }, CONFIGURE => \&modcheck, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/CGI/FormBuilder.pod', # abstract from POD AUTHOR => 'Nate Wiger (nate@wiger.org)') : () ), ); CGI-FormBuilder-3.09/PaxHeader/MANIFEST000644 777777 000000 00000000172 12246253074 020362 xustar00natewarewheel000000 000000 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715835 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/MANIFEST000644 €_$D000000 00000007626 12246253074 016366 0ustar00natewarewheel000000 000000 Changes INSTALL MANIFEST Makefile.PL Makefile.PL README lib/CGI/FormBuilder.pm lib/CGI/FormBuilder.pod lib/CGI/FormBuilder/Field.pm lib/CGI/FormBuilder/Field/button.pm lib/CGI/FormBuilder/Field/checkbox.pm lib/CGI/FormBuilder/Field/date.pm lib/CGI/FormBuilder/Field/datetime.pm lib/CGI/FormBuilder/Field/datetime_local.pm lib/CGI/FormBuilder/Field/email.pm lib/CGI/FormBuilder/Field/file.pm lib/CGI/FormBuilder/Field/hidden.pm lib/CGI/FormBuilder/Field/image.pm lib/CGI/FormBuilder/Field/number.pm lib/CGI/FormBuilder/Field/password.pm lib/CGI/FormBuilder/Field/radio.pm lib/CGI/FormBuilder/Field/select.pm lib/CGI/FormBuilder/Field/static.pm lib/CGI/FormBuilder/Field/submit.pm lib/CGI/FormBuilder/Field/text.pm lib/CGI/FormBuilder/Field/textarea.pm lib/CGI/FormBuilder/Field/time.pm lib/CGI/FormBuilder/Field/url.pm lib/CGI/FormBuilder/Messages.pm lib/CGI/FormBuilder/Messages/C.pm lib/CGI/FormBuilder/Messages/_example.pm lib/CGI/FormBuilder/Messages/base.pm lib/CGI/FormBuilder/Messages/da.pm lib/CGI/FormBuilder/Messages/da_DK.pm lib/CGI/FormBuilder/Messages/de.pm lib/CGI/FormBuilder/Messages/de_DE.pm lib/CGI/FormBuilder/Messages/default.pm lib/CGI/FormBuilder/Messages/en.pm lib/CGI/FormBuilder/Messages/en_US.pm lib/CGI/FormBuilder/Messages/es.pm lib/CGI/FormBuilder/Messages/es_ES.pm lib/CGI/FormBuilder/Messages/fr.pm lib/CGI/FormBuilder/Messages/fr_FR.pm lib/CGI/FormBuilder/Messages/ja.pm lib/CGI/FormBuilder/Messages/ja_JP.pm lib/CGI/FormBuilder/Messages/no.pm lib/CGI/FormBuilder/Messages/no_NO.pm lib/CGI/FormBuilder/Messages/ru.pm lib/CGI/FormBuilder/Messages/ru_RU.pm lib/CGI/FormBuilder/Messages/sv.pm lib/CGI/FormBuilder/Messages/sv_SE.pm lib/CGI/FormBuilder/Messages/tr.pm lib/CGI/FormBuilder/Messages/tr_TR.pm lib/CGI/FormBuilder/Multi.pm lib/CGI/FormBuilder/Source.pm lib/CGI/FormBuilder/Source/File.pm lib/CGI/FormBuilder/Template.pm lib/CGI/FormBuilder/Template/Builtin.pm lib/CGI/FormBuilder/Template/CGI_SSI.pm lib/CGI/FormBuilder/Template/Div.pm lib/CGI/FormBuilder/Template/Fast.pm lib/CGI/FormBuilder/Template/HTML.pm lib/CGI/FormBuilder/Template/TT2.pm lib/CGI/FormBuilder/Template/Text.pm lib/CGI/FormBuilder/Test.pm lib/CGI/FormBuilder/Util.pm pod/Changes.pod pod/INSTALL.pod pod/README.pod t/1a-generate.t t/1a-test01.html t/1a-test02.html t/1a-test03.html t/1a-test04.html t/1a-test05.html t/1a-test06.html t/1a-test07.html t/1a-test08.html t/1a-test09.html t/1a-test10.html t/1a-test11.html t/1a-test12.html t/1a-test13.html t/1a-test14.html t/1a-test15.html t/1a-test16.html t/1a-test17.html t/1a-test18.html t/1a-test19.html t/1a-test20.html t/1a-test21.html t/1a-test22.html t/1a-test23.html t/1a-test24.html t/1a-test25.html t/1a-test26.html t/1a-test27.html t/1a-test28.html t/1a-test29.html t/1a-test30.html t/1a-test31.html t/1a-test32.html t/1a-test33.html t/1a-test34.html t/1a-test35.html t/1a-test36.html t/1b-fields.t t/1b-test24.html t/1b-test25.html t/1b-test26.html t/1c-validate.t t/1d-messages.t t/2a-template-html.t t/2a-test00.html t/2a-test01.html t/2a-test02.html t/2a-test03.html t/2a-test04.html t/2a-test99.html t/2b-template-text.t t/2b-test00.html t/2b-test01.html t/2b-test02.html t/2b-test03.html t/2c-template-tt2.t t/2c-test00.html t/2c-test01.html t/2c-test02.html t/2c-test03.html t/2c-test04.html t/2d-template-fast.t t/2d-test01.html t/2d-test02.html t/2d-test03.html t/2e-template-ssi.t t/2e-test00.html t/2e-test01.html t/2e-test02.html t/2e-test03.html t/2e-test04.html t/2e-test99.html t/3a-source-file.t t/3a-test01.html t/3a-test02.html t/3a-test03.html t/3a-test04.html t/3a-test05.html t/3a-test06.html t/3a-test07.html t/3a-test08.html t/3a-test09.html t/3a-test10.html t/3a-test11.html t/3a-test12.html t/3a-test13.html t/3a-test14.html t/3a-test15.html t/3a-test16.html t/3a-test17.html t/3a-test18.html t/3a-test19.html t/3a-test20.html t/3a-test21.html t/3a-test22.html t/3a-test23.html t/3a-test24.html t/3a-test25.html t/3a-test26.html t/3a-test27.html t/3a-test28.html t/3b-multi-page.t t/3b-test22.html CGI-FormBuilder-3.09/PaxHeader/pod000755 777777 777777 00000000214 12246226620 016760 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715724 18 SCHILY.nlink=5 CGI-FormBuilder-3.09/pod/000755 €_$D€q{Ì00000000000 12246226620 015347 5ustar00nateware000000 000000 CGI-FormBuilder-3.09/PaxHeader/README000644 777777 000000 00000000172 12246253074 020111 xustar00natewarewheel000000 000000 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715832 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/README000644 €_$D000000 00000011031 12246253074 016076 0ustar00natewarewheel000000 000000 NAME README - README for FormBuilder 3.0, please also see Changes DESCRIPTION I hate form generation and validation because the majority of the process is tedious and mindless. In addition to being boring, there is too much room for simple error, which could render your application insecure or just plain useless. So I wrote FormBuilder to try and get rid rid of the stoopid parts, as well as take care of some tricky parts. As a result, you can build a complete application with something like this: use CGI::FormBuilder; # Assume we did a DBI query to get existing values my $dbval = $sth->fetchrow_hashref; # First create our form my $form = CGI::FormBuilder->new( fields => [qw(name email phone gender)], header => 1, method => 'POST', values => $dbval, validate => { email => 'EMAIL', phone => '/^1?-?\d{3}-?\d{3}-?\d{4}$/', }, required => 'ALL', stylesheet => '/path/to/style.css', ); # Change gender field to have options $form->field(name => 'gender', options => [qw(Male Female)] ); if ($form->submitted && $form->validate) { # Get form fields as hashref my $fields = $form->fields; # Do something to update your data (you would write this) do_data_update($fields->{name}, $fields->{email}, $fields->{phone}, $fields->{gender}); # Show confirmation screen print $form->confirm; } else { # Print out the form print $form->render; } That simple bit of code would print out an entire form, laid out in a table. Your default database values would be filled in from the DBI hashref. It would also handle stickiness across multiple submissions correctly, and it will also be able to tell if it's been submitted. Finally, it will do both JavaScript and server-side validation too. KEY FEATURES Here's the main stuff that I think is cool: Input field abstraction You simply define your fields and their values, and this module will take care of figuring out the rest. FormBuilder will automatically generate the appropriate input fields (input, select, radio, etc), even changing any JavaScript actions appropriately. Easy handling of defaults Just specify a hash of values to use as the defaults for your fields. This will be searched case-insensitively and displayed in the form. What's more, if the user enters something via the CGI that overrides a default, when you use the "field()" method to get the data you'll get the correct value. Correct stickiness Stickiness is a PITA. FormBuilder correctly handles even multiple values selected in a multiple select list, integrated with proper handling of defaults. Multiple submit mode support Related to the above, FormBuilder allows you to reliably tell whether the person clicked on the "Update" or "Delete" button of your form, normally a big pain. Robust field validation Form validation sucks, and this is where FormBuilder is a big help. It has tons of builtin patterns, and will even generate gobs of JavaScript validation code for you. You can specify your own regexps as well, and FormBuilder will correctly check even multivalued inputs. Template driver support FormBuilder can natively "drive" several major templating engines, including "HTML::Template", "Template Toolkit", and "Text::Template". if you want to build a form application with a template in less that 20 lines of Perl, FormBuilder is for you. SUPPORT If this is your first time using FormBuilder, you should check out the website for tutorials and examples at . You should also consider joining the google group at . There are some pretty smart people on the list that can help you out. Have fun! INSTALLATION For details on installation, please read the file "INSTALL". AUTHOR Copyright (c) Nate Wiger . All Rights Reserved. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. CGI-FormBuilder-3.09/PaxHeader/t000755 777777 777777 00000000216 12246226374 016451 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715728 20 SCHILY.nlink=105 CGI-FormBuilder-3.09/t/000755 €_$D€q{Ì00000000000 12246226374 015036 5ustar00nateware000000 000000 CGI-FormBuilder-3.09/t/PaxHeader/1a-generate.t000644 777777 777777 00000000214 12246226374 020777 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715729 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-generate.t000644 €_$D€q{Ì00000044712 12246226374 017324 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 1a-generate.t - test FormBuilder generation of forms use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded BEGIN { unshift @INC, "$FindBin::Bin/../lib"; my $numtests = 36; plan tests => $numtests + 1; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE&action=Unsubscribe&name=Pete+Peteson&email=pete%40peteson.com&extra=junk&other_test=_other_other_test&_other_other_test=42'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # What options we want to use, and what we expect to see my @test = ( #1 { opt => { fields => [qw/name email/], sticky => 0 }, }, #2 { opt => { fields => [qw/Upper Case/], values => { Upper => 1, Case => 0 }, table => 1 }, }, #3 { opt => { fields => [qw/first_name last_name/], submit => 'Update', reset => 0 }, }, #4 { opt => { fields => [qw/first_name last_name/], submit => 'Update', reset => 0, header => 1, body => {bgcolor => 'black'} }, }, #5 { opt => { fields => {first_name => 'Nate', email => 'nate@wiger.org' }, validate => {email => 'EMAIL'}, required => [qw/first_name/], stylesheet => 1, sticky => 0 }, }, #6 { # utilize our query_string to test stickiness opt => { fields => [qw/ticket user part_number/], method => 'post', keepextras => 1, validate => { ticket => '/^\d+$/' }, submit => [qw/Update Delete Cancel/], lalign => 'left', }, }, #7 { # max it out, baby opt => { fields => [qw/supply demand/], options => { supply => [0..9], demand => [0..9] }, values => { supply => [0..4], demand => [5..9] }, method => 'PuT', title => 'Econ 101', action => '/nowhere.cgi', header => 1, name => 'econ', font => 'arial,helvetica', fieldtype => 'select', stylesheet => 1 }, }, #8 { opt => { fields => [qw/db:name db:type db:tab ux:user ux:name/], static => 1 }, }, #9 { # single-line search thing ala Yahoo! opt => { fields => 'search', submit => 'Go', reset => 0, table => 0, fieldtype => 'textarea' }, }, #10 { opt => { fields => [qw/hostname domain/], header => 1, keepextras => [qw/user ticket/], values => [qw/localhost localdomain/], validate => {hostname => 'HOST', domain => 'DOMAIN'}, }, }, #11 { opt => { fields => {first_name => 'Nate', email => 'nate@wiger.org' }, validate => {email => 'EMAIL'}, required => [qw/first_name/], javascript => 0 }, }, #12 { opt => { fields => [qw/earth wind fire water/], fieldattr => {type => 'TEXT'}}, }, #13 { opt => { fields => [qw/earth wind fire water/], options => { wind => [qw/ /], fire => [qw/&&MURDEROUS" &&HOT" &&WARM" &&COLD" &&CHILLY" &&OUT"/], }, values => { water => '>>&c0ld&<<', earth => 'Wind >>' }, columns => 1, }, }, #14 - option maxing { opt => { fields => [qw/multiopt/], values => {multiopt => [1,2,6,9]}, options => { multiopt => [ [1 => 'One'], {2 => 'Two'}, {3 => 'Three'}, {7 => 'Seven'}, [8 => 'Eight'], [9 => 'Nine'], {4 => 'Four'}, {5 => 'Five'}, [6 => 'Six'], [10 => 'Ten'] ], }, sortopts => 'NUM', }, }, #15 - obscure features { opt => { fields => [qw/plain jane mane/], nameopts => 1, stylesheet => '/my/own/style.css', styleclass => 'style_bitch', body => {ignore => 'me'}, javascript => 0, jsfunc => " // -- user jsfunc option --\n", labels => {plain => 'AAA', jane => 'BBB'}, options => {mane => [qw/ratty nappy mr_happy/]}, selectnum => 0, title => 'Bobby', header => 1, }, }, #16 { opt => { fields => [qw/name email/], sticky => 0 }, mod => { name => {comment => 'Hey buddy'}, email => {comment => 'No email >> address??'} }, }, #17 { opt => { fields => [qw/won too many/], columns => 1 }, mod => { won => { jsclick => 'taco_punch = 1'}, too => { options => [0..2], jsclick => 'this.salami.value = "delicious"'}, many => { options => [0..9], jsclick => 'this.ham.value = "it\'s a pig, man!"'}, }, }, #18 { opt => { fields => [qw/refsort/] }, mod => { refsort => { sortopts => \&refsort, options => [qw/99 9 8 83 7 73 6 61 66 5 4 104 3 2 10 1 101/] } }, }, #19 - table attr and field columns { opt => { fields => [qw/a b c/], table => { border => 1 }, td => { taco => 'beef', align => 'right' }, tr => { valign => 'top' }, th => { ignore => 'this' }, lalign => 'today', selectnum => 10, }, mod => { a => { options => [0..3], columns => 2, value => [1..2] }, b => { options => [4..9], columns => 3, comment => "Please fill these in" }, }, }, #20 - order.cgi from manpage (big) { opt => { method => 'post', stylesheet => 1, # test 20 styleclass => 'shop', name => 'order', fields => [ qw(first_name last_name email send_me_emails address state zipcode credit_card expiration) ], header => 1, title => 'Finalize Your Order', submit => ['Place Order', 'Cancel'], reset => 0, columns => 1, validate => { email => 'EMAIL', zipcode => 'ZIPCODE', credit_card => 'CARD', expiration => 'MMYY', }, required => 'ALL', jsfunc => < { state => { options => [qw(JS IW KS UW JS UR EE DJ HI YK NK TY)], sortopts=> 'NAME' }, send_me_emails => { options => [[1 => 'Yes'], [0 => 'No']], value => 0, # "No" }, }, }, #21 - "other" fields { opt => { javascript => 1, columns => 1, }, mod => { favorite_color => { name => 'favorite_color', options => [qw(red green blue yellow)], validate => 'NAME', other => 1 } }, }, #22 - "other" fields { opt => { javascript => 0, method => "post", columns => 1, }, mod => { favorite_color => { name => 'favorite_color', options => [qw(red green blue yellow)], validate => 'NAME', other => 1 } }, }, #23 - growable fields { opt => {}, mod => { favorite_color => { name => 'favorite_color', growable => 1 } }, }, #24 - growable fields { opt => {javascript => 0}, mod => { favorite_color => { name => 'favorite_color', growable => 1 } }, }, #25 - sessionids and fieldopts { opt => { sessionid => 'H8N0TAC5', header => 1, fields => [qw(acct: phone() taco.punch salad$)], fieldopts => { 'acct:' => { true => 'false', label => 'Acct #:' }, 'phone()' => { options => [1], columns => 1, }, missing => { value => 'not here', force => 1} }, }, }, #26 - disabled forms { opt => { disabled => 'YES', cleanopts => 0, columns => 1, fields => [qw(acct phone taco salad)], fieldopts => {acct => {type => 'radio', options => [qw(on OFF)]}} }, }, #27 - autofill fields { opt => { fields => [qw(text1 text2 textthree)], columns => 1, fieldopts => {text2 => { id => 'mommy' }}, }, }, #28 - new stylesheets to test all variations { opt => { stylesheet => 'fbstyle.css', submit => [qw(Update Delete)], reset => 'Showme', method => 'POST', fields => [qw(fullname gender fav_color lover)], # need hash order header => 1, columns => 1, messages => 'auto', }, mod => { fullname => { label => 'Full Name', type => 'text', required => 1, }, gender => { label => 'Sex', options => [qw(M F)], comment => "It's one or the other", }, fav_color => { label => 'Favy Colour', options => [qw(Red Green Blue Orange Yellow Purple)], comment => 'Choose just one, even if you have more than one', invalid => 1, # tricky }, lover => { label => 'Things you love', options => [qw(Sex Drugs Rock+Roll)], multiple => 1, }, }, }, #29 - sticky in render() { opt => { fields => [qw(name email user)], values => {name => '_name_', email => '_email_', user => '_user_'}, sticky => 0, required => 0, javascript => 0, }, ren => { sticky => 1, required => 'ALL', javascript => 'auto', }, }, #30 - optgroups and selectname { opt => { fields => [qw(browser)], fieldtype => 'select', }, mod => { browser => { selectname => 1, options => [ [ '', '' ], [ '1', 'C', '' ], [ '10', 'D1', '' ], [ '9', 'D2', '' ], [ '7', 'Option 1', 'D3' ], [ '8', 'Option 2', 'D3' ], [ '2', 'H', '' ], [ '3', 'I', '' ], [ '4', 'Option 1', 'J' ], [ '40', 'Option 2', 'J' ], [ '29', 'A', 'S' ], [ '27', 'C', 'S' ], [ '12', 'E', 'S' ], [ '14', 'F', 'S' ], [ '13', 'G', 'S' ], [ '30', 'O', 'S' ], [ '28', 'P', 'S' ], [ '6', 'T', '' ], [ '22', 'V A', '' ], [ '16', 'Option 1', 'V1' ], [ '17', 'Option 2', 'V2' ], [ '18', 'Option 3', 'V2' ], [ '5', 'W', '' ] ], optgroups => { J => 'Jerky', S => 'Shoddy', }, }, select2 => { selectname => 0, options => [qw(a b)], }, select3 => { selectname => 'choosey2', options => [qw(a b)], }, }, }, #31 - Backbase tagname support (experiemental) { opt => { stylesheet => 'fbstyle.css', submit => [qw(Update Delete)], reset => 'Showme', method => 'POST', fields => [qw(fullname gender fav_color lover)], # need hash order header => 1, columns => 1, messages => 'auto', tagnames => { name => 'b:name', select => 'b:select', value => 'b:value', option => 'b:option', input => 'b:input', table => 'div', tr => 'div', th => 'div', td => 'div', }, }, mod => { fullname => { label => 'Full Name', type => 'text', required => 1, }, gender => { label => 'Sex', options => [qw(M F)], comment => "It's one or the other", }, fav_color => { label => 'Favy Colour', options => [qw(Red Green Blue Orange Yellow Purple)], comment => 'Choose just one, even if you have more than one', invalid => 1, # tricky }, lover => { label => 'Things you love', options => [qw(Sex Drugs Rock+Roll)], multiple => 1, }, }, }, #32 - fieldsets { opt => { name => 'account', fieldsets => [[acct=>'Account Information'], [prefs=>'User Preferences'], [phone=>'Phone Number(s)']], stylesheet => 1, fields => [qw/first_name last_name outside_1 email home_phone new_set work_phone call_me email_me outside_2 sex outside_3/], }, mod => { first_name => { fieldset => 'acct' }, last_name => { fieldset => 'acct' }, email => { fieldset => 'acct' }, home_phone => { fieldset => 'phone' }, work_phone => { fieldset => 'phone' }, new_set => { fieldset => 'Inline Created' }, call_me => { fieldset => 'prefs' }, email_me => { fieldset => 'prefs' }, first_name => { fieldset => 'acct' }, sex => { fieldset => 'acct', options => [qw/Yes No/] }, }, }, #33 - builtin Div.pm "template" support { opt => { name => 'parts', fields => [qw/ticket user email part_number/], fieldsets => [[acct=>'Account Information'], [prefs=>'Part Information']], method => 'post', keepextras => 1, validate => { ticket => '/^\d+$/' }, submit => [qw/Update Delete Cancel/], lalign => 'left', template => {type => 'div'}, stylesheet => 1, }, mod => { ticket => { fieldset => 'acct' }, email => { fieldset => 'prefs' }, }, }, # Older tests moved from 1b-fields #34 - misc checkboxes { opt => { fields => [qw/name color/], labels => {color => 'Favorite Color'}, validate => {email => 'EMAIL'}, required => [qw/name/], sticky => 0, columns => 1, action => 'TEST', title => 'TEST', }, mod => { color => { options => [qw(red> green& blue")], multiple => 1, cleanopts => 0, }, name => { options => [qw(lower UPPER)], nameopts => 1, }, }, }, #35 { # check individual fields as static opt => { fields => [qw/name email color/], action => 'TEST', columns => 1 }, mod => { name => { static => 1 }, email => { type => 'static' }, }, }, #36 { opt => { fields => [qw/name color hid1 hid2/], action => 'TEST', columns => 1, values => { hid1 => 'Val1a' }, }, mod => { name => { static => 1, type => 'text' }, hid1 => { type => 'hidden', value => 'Val1b' }, # should replace Val1a hid2 => { type => 'hidden', value => 'Val2' }, color => { value => 'blew', options => [qw(read blew yell)] }, Tummy => { value => [qw(lg xxl)], options => [qw(sm med lg xl xxl xxxl)] }, }, }, ); sub refsort { $_[0] <=> $_[1] } # Perl 5 is sick sometimes. @test = @test[$ARGV[0] - 1] if @ARGV; my $seq = $ARGV[0] || 1; $ENV{HTTP_ACCEPT_LANGUAGE} = 'en_US'; # To test local %TAGNAMES $CGI::FormBuilder::Util::TAGNAMES{name} = 'yellow'; # Cycle thru and try it out for (@test) { my $form = CGI::FormBuilder->new( debug => $DEBUG, header => $ENV{HEADER} || 0, action => 'TEST', # testing title => 'TEST', %{ $_->{opt} } ); # the ${mod} key twiddles fields for my $f ( sort keys %{$_->{mod} || {}} ) { my $o = $_->{mod}{$f}; $o->{name} = $f; $form->field(%$o); } # just compare the output of render with what's expected # the correct string output is now in external files my $out = outfile($seq++); my $ren = $form->render(%{$_->{ren} || {}}); my $ok = ok($ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } ok($CGI::FormBuilder::Util::TAGNAMES{name}, 'yellow'); CGI-FormBuilder-3.09/t/PaxHeader/1a-test01.html000644 777777 777777 00000000214 12246225402 021015 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715730 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test01.html000644 €_$D€q{Ì00000000714 12246225402 017334 0ustar00nateware000000 000000
Name
Email
CGI-FormBuilder-3.09/t/PaxHeader/1a-test02.html000644 777777 777777 00000000214 12246225402 021016 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715731 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test02.html000644 €_$D€q{Ì00000000740 12246225402 017334 0ustar00nateware000000 000000
Upper
Case
CGI-FormBuilder-3.09/t/PaxHeader/1a-test03.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715732 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test03.html000644 €_$D€q{Ì00000000752 12246225402 017340 0ustar00nateware000000 000000
First Name
Last Name
CGI-FormBuilder-3.09/t/PaxHeader/1a-test04.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715733 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test04.html000644 €_$D€q{Ì00000001142 12246225402 017333 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

First Name
Last Name
CGI-FormBuilder-3.09/t/PaxHeader/1a-test05.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715734 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test05.html000644 €_$D€q{Ì00000004051 12246225402 017336 0ustar00nateware000000 000000

Fields that are highlighted are required.

Email
First Name
CGI-FormBuilder-3.09/t/PaxHeader/1a-test06.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715735 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test06.html000644 €_$D€q{Ì00000004464 12246225402 017347 0ustar00nateware000000 000000

Fields that are highlighted are required.

Ticket
User
Part Number
CGI-FormBuilder-3.09/t/PaxHeader/1a-test07.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715736 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test07.html000644 €_$D€q{Ì00000003436 12246225402 017346 0ustar00nateware000000 000000 Content-type: text/html Econ 101

Econ 101

Supply
Demand
CGI-FormBuilder-3.09/t/PaxHeader/1a-test08.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715737 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test08.html000644 €_$D€q{Ì00000001231 12246225402 017336 0ustar00nateware000000 000000
Db Name
Db Type
Db Tab
Ux User
Ux Name
CGI-FormBuilder-3.09/t/PaxHeader/1a-test09.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715738 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test09.html000644 €_$D€q{Ì00000000372 12246225402 017344 0ustar00nateware000000 000000
Search
CGI-FormBuilder-3.09/t/PaxHeader/1a-test10.html000644 777777 777777 00000000214 12246225402 021015 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715739 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test10.html000644 €_$D€q{Ì00000004166 12246225402 017341 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

Fields that are highlighted are required.

Hostname
Domain
CGI-FormBuilder-3.09/t/PaxHeader/1a-test11.html000644 777777 777777 00000000214 12246225402 021016 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715740 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test11.html000644 €_$D€q{Ì00000001103 12246225402 017326 0ustar00nateware000000 000000

Fields that are highlighted are required.

Email
First Name
CGI-FormBuilder-3.09/t/PaxHeader/1a-test12.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715741 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test12.html000644 €_$D€q{Ì00000001215 12246225402 017333 0ustar00nateware000000 000000
Earth
Wind
Fire
Water
CGI-FormBuilder-3.09/t/PaxHeader/1a-test13.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715742 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test13.html000644 €_$D€q{Ì00000003131 12246225402 017333 0ustar00nateware000000 000000
Earth
Wind
Fire
Water
CGI-FormBuilder-3.09/t/PaxHeader/1a-test14.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715743 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test14.html000644 €_$D€q{Ì00000001455 12246225402 017343 0ustar00nateware000000 000000
Multiopt
CGI-FormBuilder-3.09/t/PaxHeader/1a-test15.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715744 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test15.html000644 €_$D€q{Ì00000002245 12246225402 017342 0ustar00nateware000000 000000 Content-type: text/html Bobby

Bobby

AAA
BBB
Mane
CGI-FormBuilder-3.09/t/PaxHeader/1a-test16.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715745 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test16.html000644 €_$D€q{Ì00000000754 12246225402 017346 0ustar00nateware000000 000000
Name Hey buddy
Email No email >> address??
CGI-FormBuilder-3.09/t/PaxHeader/1a-test17.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715746 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test17.html000644 €_$D€q{Ì00000002713 12246225402 017344 0ustar00nateware000000 000000
Won
Too
Many
CGI-FormBuilder-3.09/t/PaxHeader/1a-test18.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715747 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test18.html000644 €_$D€q{Ì00000001672 12246225402 017350 0ustar00nateware000000 000000
Refsort
CGI-FormBuilder-3.09/t/PaxHeader/1a-test19.html000644 777777 777777 00000000214 12246225402 021026 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715748 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test19.html000644 €_$D€q{Ì00000003501 12246225402 017342 0ustar00nateware000000 000000
A
B
Please fill these in
C
CGI-FormBuilder-3.09/t/PaxHeader/1a-test20.html000644 777777 777777 00000000214 12246225402 021016 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715749 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test20.html000644 €_$D€q{Ì00000021036 12246225402 017335 0ustar00nateware000000 000000 Content-type: text/html Finalize Your Order

Finalize Your Order

Fields that are highlighted are required.

First Name
Last Name
Email
Send Me Emails
Address
State
Zipcode
Credit Card
Expiration
CGI-FormBuilder-3.09/t/PaxHeader/1a-test21.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715750 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test21.html000644 €_$D€q{Ì00000006430 12246225402 017337 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/1a-test22.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715751 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test22.html000644 €_$D€q{Ì00000002417 12246225402 017341 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/1a-test23.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715752 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test23.html000644 €_$D€q{Ì00000003617 12246225402 017345 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/1a-test24.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715753 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test24.html000644 €_$D€q{Ì00000000610 12246225402 017334 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/1a-test25.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715754 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test25.html000644 €_$D€q{Ì00000001731 12246225402 017342 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

Acct #:
Phone
Taco
Salad
CGI-FormBuilder-3.09/t/PaxHeader/1a-test26.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715755 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test26.html000644 €_$D€q{Ì00000001673 12246225402 017350 0ustar00nateware000000 000000
Acct
Phone
Taco
Salad
CGI-FormBuilder-3.09/t/PaxHeader/1a-test27.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715756 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test27.html000644 €_$D€q{Ì00000001075 12246225402 017345 0ustar00nateware000000 000000
Text1
Text2
Textthree
CGI-FormBuilder-3.09/t/PaxHeader/1a-test28.html000644 777777 777777 00000000214 12246225402 021026 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715757 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test28.html000644 €_$D€q{Ì00000007356 12246225402 017356 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

1 error(s) were encountered with your submission. Please correct the fields highlighted below.

Full Name
Sex
It's one or the other
Favy Colour Select an option from this list Choose just one, even if you have more than one
Things you love
CGI-FormBuilder-3.09/t/PaxHeader/1a-test29.html000644 777777 777777 00000000214 12246225402 021027 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715758 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test29.html000644 €_$D€q{Ì00000004205 12246225402 017345 0ustar00nateware000000 000000

Fields that are highlighted are required.

Name
Email
User
CGI-FormBuilder-3.09/t/PaxHeader/1a-test30.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715759 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test30.html000644 €_$D€q{Ì00000003324 12246225402 017336 0ustar00nateware000000 000000
Browser
Select2
Select3
CGI-FormBuilder-3.09/t/PaxHeader/1a-test31.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715760 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test31.html000644 €_$D€q{Ì00000007465 12246225402 017351 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

1 error(s) were encountered with your submission. Please correct the fields highlighted below.

Full Name
Sex
It's one or the other
Favy Colour
-select- Red Green Blue Orange Yellow Purple Select an option from this list Choose just one, even if you have more than one
Things you love
CGI-FormBuilder-3.09/t/PaxHeader/1a-test32.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715761 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test32.html000644 €_$D€q{Ì00000007742 12246225402 017350 0ustar00nateware000000 000000
Account Information
First Name
Last Name
Email
Sex
User Preferences
Call Me
Email Me
Phone Number(s)
Home Phone
Work Phone
Inline Created
New Set
Outside 1
Outside 2
Outside 3
CGI-FormBuilder-3.09/t/PaxHeader/1a-test33.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715762 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test33.html000644 €_$D€q{Ì00000006711 12246225402 017344 0ustar00nateware000000 000000

Fields that are highlighted are required.

Account Information
Ticket
Part Information
Email
User
Part Number
CGI-FormBuilder-3.09/t/PaxHeader/1a-test34.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715763 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test34.html000644 €_$D€q{Ì00000005031 12246225402 017337 0ustar00nateware000000 000000

Fields that are highlighted are required.

Name
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/1a-test35.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715764 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test35.html000644 €_$D€q{Ì00000001174 12246225402 017344 0ustar00nateware000000 000000
Name Pete Peteson
Email pete@peteson.com
Color
CGI-FormBuilder-3.09/t/PaxHeader/1a-test36.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715765 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1a-test36.html000644 €_$D€q{Ì00000002565 12246225402 017352 0ustar00nateware000000 000000
Name Pete Peteson
Color
Tummy
CGI-FormBuilder-3.09/t/PaxHeader/1b-fields.t000644 777777 777777 00000000214 12246226374 020454 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715766 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1b-fields.t000644 €_$D€q{Ì00000027427 12246226374 017005 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 1b-fields.t - test Field generation/handling use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; use File::Find; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded BEGIN { unshift @INC, "$FindBin::Bin/../lib"; my $numtests = 26; plan tests => $numtests; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Fake a submission request $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE&action=Unsubscribe&name=Pete+Peteson&email=pete%40peteson.com&extra=junk&_submitted=1&blank=&two=&two=&other_test=_other_other_test&_other_other_test=42&other_test_2=_other_other_test_2&_other_other_test_2=nope'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # jump to a test if specified for debugging (goto eek!) my $t = shift; if ($t) { eval sprintf("goto T%2.2d", $t); die; } # Now manually try a whole bunch of things #1 T01: ok(do { my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/user name email/]); if ($form->submitted) { 1; } else { 0; } }, 1); exit if $t; #2 T02: ok(do { my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/user name email/], validate => { email => 'EMAIL' } ); if ($form->submitted && $form->validate) { 1; } else { 0; } }, 1); exit if $t; #3 T03: ok(do { # this should fail since we are saying our email should be a netmask my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/user name email/], validate => { email => 'NETMASK' } ); if ($form->submitted && $form->validate) { 0; # failure } else { 1; } }, 1); exit if $t; #4 T04: ok(do { # this should also fail since the submission key will be _submitted_magic, # and our query_string only has _submitted in it my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/user name email/], name => 'magic'); if ($form->submitted) { 0; # failure } else { 1; } }, 1); exit if $t; #5 T05: ok(do { # CGI should override default values my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/user name email/], values => { user => 'jim' } ); if ($form->submitted && $form->field('user') eq 'pete') { 1; } else { 0; } }, 1); exit if $t; #6 T06: ok(do { # test a similar thing, by with mixed-case values my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/user name email Addr/], values => { User => 'jim', ADDR => 'Hello' } ); if ($form->submitted && $form->field('Addr') eq 'Hello') { 1; } else { 0; } }, 1); exit if $t; #7 T07: ok(do { # test a similar thing, by with mixed-case values my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => { User => 'jim', ADDR => 'Hello' } ); if ($form->submitted && ! $form->field('Addr') && $form->field('ADDR') eq 'Hello') { 1; } else { 0; } }, 1); exit if $t; #8 T08: ok(do { my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => []); # no fields! if ($form->submitted) { if ($form->field('name') || $form->field('extra')) { # if we get here, this means that the restrictive field # masking is not working, and all CGI params are available -1; } elsif ($form->cgi_param('name')) { 1; } else { 0; } } else { 0; } }, 1); exit if $t; #9 T09: ok(do { # test if required does what v1.97 thinks it should (should fail) my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => { user => 'nwiger', pass => '' }, validate => { user => 'USER' }, required => [qw/pass/]); if ($form->submitted && $form->validate) { 0; } else { 1; } }, 1); exit if $t; #10 T10: ok(do { # YARC (yet another 'required' check) my $form = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/name email phone/], validate => {email => 'EMAIL', phone => 'PHONE'}, required => [qw/name email/], ); if ($form->submitted && $form->validate) { 1; } else { 0; } }, 1); exit if $t; #11 T11: ok(do { # test of proper CGI precendence when manually setting values my $form = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/name email action/], validate => {email => 'EMAIL'}, required => [qw/name email/], ); $form->field(name => 'action', options => [qw/Subscribe Unsubscribe/], value => 'Subscribe'); if ($form->submitted && $form->validate && $form->field('action') eq 'Unsubscribe') { 1; } else { 0; } }, 1); exit if $t; #12 T12: ok(do { # test of proper CGI precendence when manually setting values my $form = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/name email blank notpresent/], values => {blank => 'DEF', name => 'DEF'} ); if (defined($form->field('blank')) && ! $form->field('blank') && $form->field('name') eq 'Pete Peteson' && ! defined($form->field('notpresent')) ) { 1; } else { 0; } }, 1); exit if $t; #13 T13: ok(do { # test of proper CGI precendence when manually setting values my $form = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/name email blank/], keepextras => 0, # should still get value action => 'TEST', ); if (! $form->field('extra') && $form->cgi_param('extra') eq 'junk') { 1; } else { 0; } }, 1); exit if $t; #14 T14: ok(do{ my $form = CGI::FormBuilder->new(debug => $DEBUG, fields => [qw/name color dress_size taco:punch/]); $form->field(name => 'blank', value => 175, force => 1); $form->field(name => 'user', value => 'bob'); if ($form->field('blank') eq 175 && $form->field('user') eq 'pete') { 1; } else { 0; } }, 1); exit if $t; #15 T15: ok(do{ my $form = CGI::FormBuilder->new( debug => $DEBUG, smartness => 0, javascript => 0, ); $form->field(name => 'blank', value => 'aoe', type => 'text'); $form->field(name => 'extra', value => '24', type => 'hidden', override => 1); $form->field(name => 'two', value => 'one'); my @v = $form->field('two'); if ($form->submitted && $form->validate && defined($form->field('blank')) && ! $form->field('blank') && $form->field('extra') eq 24 && @v == 2) { 1; } else { 0; } }, 1); exit if $t; #16 T16: ok(do{ my $form = CGI::FormBuilder->new(debug => $DEBUG); $form->fields([qw/one two three/]); my @v; if (@v = $form->field('two') and @v == 2) { 1; } else { 0; } }, 1); exit if $t; #17 T17: ok(do{ my $form = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/one two three/], fieldtype => 'TextAREA', ); $form->field(name => 'added_later', label => 'Yo'); my $ok = 1; for ($form->fields) { $ok = 0 unless $_->render =~ /textarea/i; } $ok; }, 1); exit if $t; #18 T18: ok(do{ my $form = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/a b c/], fieldattr => {type => 'TOMATO'}, values => {a => 'Ay', b => 'Bee', c => 'Sea'}, ); $form->values(a => 'a', b => 'b', c => 'c'); my $ok = 1; for ($form->fields) { $ok = 0 unless $_->value eq $_; } $ok; }, 1); exit if $t; #19 T19: ok(do{ my $form = CGI::FormBuilder->new( fields => [qw/name user/], required => 'ALL', sticky => 0, ); my $ok = 1; my $name = $form->field('name'); $ok = 0 unless $name eq 'Pete Peteson'; my $user = $form->field('user'); $ok = 0 unless $user eq 'pete'; for ($form->fields) { $ok = 0 unless $_->tag eq qq(); } $ok; }, 1); exit if $t; #20 - other field values T20: ok(do{ my $form = CGI::FormBuilder->new; $form->field(name => 'other_test', other => 1, type => 'select'); $form->field(name => 'other_test_2', other => 0, value => 'nope'); my $ok = 1; $ok = 0 unless $form->field('other_test') eq '42'; $ok = 0 unless $form->field('other_test_2') eq '_other_other_test_2'; $ok; }, 1); exit if $t; #21 - inflate coderef T21: ok(do{ my $form = CGI::FormBuilder->new; $form->field( name => 'inflate_test', value => '2003-04-05 06:07:08', inflate => sub { return [ split /\D+/, shift ] }, ); my $ok = 1; my $val = $form->field('inflate_test'); $ok = 0 unless ref $val eq 'ARRAY'; my $i = 0; $ok = 0 if grep { ($val->[$i++] != $_) } 2003, 4, 5, 6, 7, 8; $ok; }, 1); #22 - don't tell anyone this works T22: ok(do{ my $form = CGI::FormBuilder->new; my $val = $form->field( name => 'forty-two', value => 42 ); $val == 42; }, 1); #23 - try to catch bad \%opt destruction errors T23: ok(do{ my $opt = { source => {type => 'File', source => \"name: one\nfields:a,b"}, values => {a=>1,b=>2,c=>3,d=>4}, options => {a=>[1,2,3], d=>[4..10]}, submit => 'Yeah', }; my $form1 = CGI::FormBuilder->new($opt); my $render1 = $form1->render; my $form2 = CGI::FormBuilder->new($opt); my $render2 = $form2->render; $opt->{source} = { type => 'File', source => \"name: two\nmethod:post\nfields:c,d", }; my $form3 = CGI::FormBuilder->new($opt); $render1 eq $render2 && ! $form3->{fieldrefs}{a} && ! $form3->{fieldrefs}{b}; #warn "RENDER1 = $render1"; #warn "RENDER3 = " . $form3->render; }, 1); #24 - fucking rt.cpan shit T24: ok(do{ my $form = CGI::FormBuilder->new; $form->field(name => 'other_test', other => 1, type => 'select', options => [1..5], value => 6); my $ok = 1; # you know what? fuck Perl $form->script; # internals thing my($f) = grep /^other_test$/, $form->field; my $h = $f->tag . "\n"; $h eq outfile(24) ? 1 : 0; }, 1); #25 - fucking rt.cpan shit T25: ok(do{ my $form = CGI::FormBuilder->new; $form->field(name => 'butter_test', other => 1, type => 'select', options => [1..5]); # no value my $ok = 1; # you know what? fuck Perl $form->script; # internals thing my($f) = grep /^butter_test$/, $form->field; my $h = $f->tag . "\n"; $h eq outfile(25) ? 1 : 0; }, 1); #26 - fucking rt.cpan shit T26: ok(do{ my $form = CGI::FormBuilder->new; $form->field(name => 'butter_test', other => 1, type => 'select', options => [1..5], value => undef); # undef value my $ok = 1; # you know what? fuck Perl $form->script; # internals thing my($f) = grep /^butter_test$/, $form->field; my $h = $f->tag . "\n"; $h eq outfile(26) ? 1 : 0; }, 1); CGI-FormBuilder-3.09/t/PaxHeader/1b-test24.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715767 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1b-test24.html000644 €_$D€q{Ì00000001036 12246225402 017340 0ustar00nateware000000 000000 CGI-FormBuilder-3.09/t/PaxHeader/1b-test25.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715768 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1b-test25.html000644 €_$D€q{Ì00000001032 12246225402 017335 0ustar00nateware000000 000000 CGI-FormBuilder-3.09/t/PaxHeader/1b-test26.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715769 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1b-test26.html000644 €_$D€q{Ì00000001032 12246225402 017336 0ustar00nateware000000 000000 CGI-FormBuilder-3.09/t/PaxHeader/1c-validate.t000644 777777 777777 00000000214 12246226374 021000 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715770 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1c-validate.t000644 €_$D€q{Ì00000011500 12246226374 017312 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 1c-validate.t - test validation use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded BEGIN { my $numtests = 13; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = '_submitted=1&submit=ClickMe&blank=&hiphop=Early+East+Coast'; use CGI::FormBuilder 3.09; sub is_number { my $v = shift; return $v =~ /^\d+$/; } # What options we want to use, and data to validate my @test = ( #1 { opt => { fields => [qw/first_name email/], validate => {email => 'EMAIL'}, required => [qw/first_name/] , values => { first_name => 'Nate', email => 'nate@wiger.org' }, }, pass => 1, }, #2 { # max it out, baby opt => { fields => [qw/supply demand/], options => { supply => [0..9], demand => [0..9] }, values => { supply => [0..4], demand => [5..7] }, validate => { supply => [5..9], demand => [0..9] }, }, pass => 0, }, #3 { # max it out, baby opt => { fields => [qw/supply tag/], options => { supply => [0..9], }, values => { supply => [0..4], tag => ['Johan-Sebastian', 'Bach'] }, validate => { supply => 'NUM', tag => 'NAME' }, }, pass => 0, }, #4 { opt => { fields => [qw/date time ip_addr name time_confirm/], validate => { date => 'DATE', time => 'TIME', ip_addr => 'IPV4', time_confirm => 'eq $form->field("time")' }, values => { date => '03/30/2003', time => '1:30', ip_addr => '129.153.53.1', time_confirm => '1:30' }, }, pass => 1, }, #5 { opt => { fields => [qw/security_test/], validate => { security_test => 'ne 42' }, values => { security_test => "'; print join ':', \@INC; return; '" }, }, pass => 1, }, #6 { opt => { fields => [qw/security_test2/], validate => { security_test2 => 'ne 42' }, values => { security_test2 => 'foo\';`cat /etc/passwd`;\'foo' }, }, pass => 1, }, #7 { opt => { fields => [qw/subref_num/], values => {subref_num => [0..9]}, validate => {subref_num => \&is_number}, }, pass => 1, }, #8 { opt => { fields => [qw/blank/], values => {blank => '1@2.com'}, validate => {blank => 'EMAIL'}, required => 'NONE', }, pass => 1, }, #9 { opt => { fields => [qw/blank/], values => {blank => '1@2.com'}, validate => {blank => 'EMAIL'}, required => [qw/blank/], }, pass => 0, # should fail }, #10 { opt => { fields => [qw/tomato potato/], values => {tomato => 'TomaTo', potato => '~SQUASH~'}, validate => {tomato => {perl => '=~ /^TomaTo$/', javascript => 'placeholder'}, potato => {perl => 'VALUE', javascript => 'placeholder'}, }, }, pass => 1, }, #11 { opt => { fields => [qw/have you seen/], values => { you => 'me', seen => 'OB', have => "Nothing" }, validate => { have => '/^Not/' }, required => 'ALL' }, pass => 1, }, #12 { opt => { fields => [qw/required_zero required_space/], values => { required_zero => '0', required_space => ' ' }, required => 'ALL' }, pass => 1, }, #13 { opt => { fields => [qw/required_empty/], values => { required_empty => '' }, required => 'ALL' }, pass => 0, }, ); # Cycle thru and try it out for my $t (@test) { my $form = CGI::FormBuilder->new( %{ $t->{opt} }, debug => $DEBUG ); while(my($f,$o) = each %{$t->{mod} || {}}) { $o->{name} = $f; $form->field(%$o); } # just try to validate ok($form->validate, $t->{pass} || 0); } CGI-FormBuilder-3.09/t/PaxHeader/1d-messages.t000644 777777 777777 00000000214 12246226374 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715771 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/1d-messages.t000644 €_$D€q{Ì00000010523 12246226374 017335 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 1d-messages.t - messages and localization use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; use File::Find; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded my @pm; my %messages; BEGIN { die $! unless -d "$FindBin::Bin/../lib"; unshift @INC, "$FindBin::Bin/../lib"; %messages = ( form_invalid_text => 'You fucked up', js_invalid_text => 'Yep, shit sucks!', form_select_default => '*<- choose ->*', taco_salad => 'is delicious', parade => [1,2,3], form_invalid_text => '%s', form_invalid_input => 'Invalid entry', form_invalid_select => 'Select an option from this list', form_invalid_checkbox => 'Check one or more options', form_invalid_radio => 'Choose an option', form_invalid_password => 'Invalid entry', form_invalid_textarea => 'Please fill this in', form_invalid_file => 'Invalid filename', form_invalid_default => 'Invalid entry', ); # try to load all the messages .pm files find(sub{ push @pm, $File::Find::name if -f $_ && $File::Find::name =~ m#Messages/[a-z]+_[A-Z]+\.pm$#; }, "$FindBin::Bin/../lib"); die "Found 0 Messages.pm files in $FindBin::Bin/../lib, this is wrong" if @pm == 0; # die "pm = @pm"; # # There are 34 keys, times the number of modules, plus one load of the module. # Then, also add in our custom tests as well, which is two passes over # the %messages hash (above) plus 4 charset/dtd checks # require CGI::FormBuilder::Messages::default; my %hash = CGI::FormBuilder::Messages::default->messages; my $numkeys = keys %hash; my $numtests = ($numkeys * @pm) + @pm + (keys(%messages) * 2) + 4; plan tests => $numtests; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Messages, both inline and file my $locale = "fb_FAKE"; my $messages = "messages.$locale"; open(M, ">$messages") || warn "Can't write $messages: $!"; while (my($k,$v) = each %messages) { print M join(' ', $k, ref($v) ? @$v : $v), "\n"; } close(M); # Fake a submission request $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE&action=Unsubscribe&name=Pete+Peteson&email=pete%40peteson.com&extra=junk&_submitted=1&blank=&two=&two='; use CGI::FormBuilder 3.09; # Now manually try a whole bunch of things my $hash = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/user name email/], messages => \%messages ); for my $k (sort keys %messages) { #local $" = ', '; ok($hash->messages->$k, ref($messages{$k}) ? "@{$messages{$k}}" : $messages{$k}); } my $file = CGI::FormBuilder->new( debug => $DEBUG, fields => [qw/user name email/], messages => $messages, ); for my $k (sort keys %messages) { #local $" = ', '; ok($file->messages->$k, ref($messages{$k}) ? "@{$messages{$k}}" : $messages{$k}); } unlink $messages; # Check to ensure our lang and charset work correctly { local $TESTING = 0; ok($file->charset, 'iso-8859-1'); ok($file->lang, 'en_US'); ok($file->dtd, < EOD ok($file->charset('yo.momma'), 'yo.momma'); } # Final test set is to just make sure we have all the keys for all modules require CGI::FormBuilder::Messages::default; my %need = CGI::FormBuilder::Messages::default->messages; my @keys = keys %need; for my $pm (@pm) { my($lang) = $pm =~ /([a-z]+_[A-Z]+)/; my $skip = $lang ? undef : "skip: Can't get language from $pm"; my $form; eval { $form = CGI::FormBuilder->new(messages => ":$lang"); }; skip($skip, !$@); for (@keys) { skip($skip, $form->{messages}->$_) || warn "Locale $lang: missing $_\n"; } } CGI-FormBuilder-3.09/t/PaxHeader/2a-template-html.t000644 777777 777777 00000000214 12246226374 021763 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715772 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-template-html.t000644 €_$D€q{Ì00000011037 12246226374 020302 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) 2000-2006 Nathan Wiger . # All Rights Reserved. If you're reading this, you're bored. # 2a-template-html.t - test HTML::Template support use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded our $SKIP; BEGIN { my $numtests = 5; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # try to load template engine so absent template does # not cause all tests to fail eval "require HTML::Template"; $SKIP = $@ ? 'skip: HTML::Template not installed here' : 0; # eval failed, skip all tests # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # Grab our template from our test00.html file my $template = outfile(0); my $kurtlidl = outfile(99); # What options we want to use, and what we expect to see my @test = ( { opt => { fields => [qw/name color/], submit => 0, reset => 'No esta una button del submito', template => { scalarref => \$template }, validate => { name => 'NAME' }, }, mod => { color => { options => [qw/red green blue/], nameopts => 1 }, size => { value => 42 } }, }, { opt => { fields => [qw/name color size/], template => { scalarref => \$template }, values => {color => [qw/purple/], size => 8}, reset => 'Start over, boob!', validate => {}, # should be empty }, mod => { color => { options => [qw/white black other/] }, name => { size => 80 } }, }, { opt => { fields => [qw/name color email/], submit => [qw/Update Delete/], reset => 0, template => { scalarref => \$template }, values => {color => [qw/yellow green orange/]}, validate => { color => [qw(red blue yellow pink)] }, }, mod => { color => {options => [[red => 1], [blue => 2], [yellow => 3], [pink => 4]] }, size => {value => '(unknown)' } }, }, { opt => { fields => [qw/field1 field2/], method => 'post', title => 'test form page', header => 0, template => { scalarref => \$kurtlidl }, }, mod => { field1 => { value => 109, comment => 'Hello' }, field2 => { type => 'submit', value => "1 < 2 < 3", label => "Reefer", comment => 'goodbyE@' }, field3 => { type => 'button', value => "<>", comment => 'onSubmit' }, }, }, ); # Perl 5 is sick sometimes. @test = @test[$ARGV[0] - 1] if @ARGV; my $seq = $ARGV[0] || 1; # Cycle thru and try it out for (@test) { my $form = CGI::FormBuilder->new( debug => $DEBUG, action => 'TEST', title => 'TEST', %{ $_->{opt} }, ); # the ${mod} key twiddles fields while(my($f,$o) = each %{$_->{mod} || {}}) { $o->{name} = $f; $form->field(%$o); } # # Just compare the output of render with what's expected # the correct string output is now in external files. # The seemingly extra eval is required so that failures # to import the template modules do not kill the tests. # (since render is called regardless of whether $SKIP is set) # my $out = outfile($seq++); my $ren = $SKIP ? '' : $form->render; my $ok = skip($SKIP, $ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { #use Data::Dumper; #die Dumper($form); open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } # MORE TESTS DOWN HERE # from eszpee for tmpl_param skip($SKIP, do{ my $form2 = CGI::FormBuilder->new( template => { scalarref => \'' } ); $form2->tmpl_param(test => "this message should appear"); eval '$form2->render'; }, 'this message should appear'); CGI-FormBuilder-3.09/t/PaxHeader/2a-test00.html000644 777777 777777 00000000214 12246225402 021015 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715773 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-test00.html000644 €_$D€q{Ì00000000716 12246225402 017336 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is
CGI-FormBuilder-3.09/t/PaxHeader/2a-test01.html000644 777777 777777 00000000214 12246225402 021016 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715774 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-test01.html000644 €_$D€q{Ì00000002574 12246225402 017343 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is 42
CGI-FormBuilder-3.09/t/PaxHeader/2a-test02.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715775 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-test02.html000644 €_$D€q{Ì00000001152 12246225402 017333 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is 8
CGI-FormBuilder-3.09/t/PaxHeader/2a-test03.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715776 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-test03.html000644 €_$D€q{Ì00000004003 12246225402 017332 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is (unknown)
CGI-FormBuilder-3.09/t/PaxHeader/2a-test04.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715777 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-test04.html000644 €_$D€q{Ì00000002227 12246225402 017341 0ustar00nateware000000 000000 Test
test form page:
Field1 Hello
Reefer goodbyE@
Field3 onSubmit

CGI-FormBuilder-3.09/t/PaxHeader/2a-test99.html000644 777777 777777 00000000214 12246225402 021037 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715778 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2a-test99.html000644 €_$D€q{Ì00000001264 12246225402 017357 0ustar00nateware000000 000000 Test :

CGI-FormBuilder-3.09/t/PaxHeader/2b-template-text.t000644 777777 777777 00000000214 12246226374 022004 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715779 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2b-template-text.t000644 €_$D€q{Ì00000010705 12246226374 020324 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) 2000-2006 Nathan Wiger . # All Rights Reserved. If you're reading this, you're bored. # 2b-template-text.t - test Text::Template support use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded our $SKIP; BEGIN { my $numtests = 4; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # try to load template engine so absent template does # not cause all tests to fail eval "require Text::Template"; $SKIP = $@ ? 'skip: Text::Template not installed here' : 0; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # Create our template and store it in a scalarref my $template = outfile(0); # What options we want to use, and what we expect to see my @test = ( { opt => { fields => [qw/name color/], submit => 'No esta una button del resetto', template => { type => 'Text', TYPE => 'STRING', template => $template, }, validate => { name => 'NAME' }, }, mod => { color => { options => [qw/red green blue/], label => 'Best Color', value => 'red' }, size => { value => 42 }, sex => { options => [[M=>'Male'],[F=>'Female']] } }, }, { opt => { fields => [qw/name color size/], template => { type => 'Text', TYPE => 'STRING', template => $template, }, values => {color => [qw/purple/], size => 8}, submit => 'Start over, boob!', }, mod => { color => { options => [[white=>'White'],[black=>'Black'],[red=>'Green']], label => 'Mom', }, name => { size => 80, maxlength => 80, comment => 'Fuck off' }, sex => { options => [[1=>'Yes'], [0=>'No'], [-1=>'Maybe']], label => 'Fuck me?
' }, }, }, { opt => { fields => [qw/name color email/], submit => [qw/Update Delete/], reset => 0, template => { type => 'Text', TYPE => 'STRING', template => $template, }, values => {color => [qw/yellow green orange/]}, validate => { sex => [qw(1 3 5)] }, }, mod => { color => {options => [[red => 1], [blue => 2], [yellow => 3], [pink => 4]] }, size => {comment => '(unknown)', value => undef, force => 1 } , sex => {label => 'glass EYE fucker', options => [[1,2],[3,4],[5,6]] }, }, }, ); # Perl 5 is sick sometimes. @test = @test[$ARGV[0] - 1] if @ARGV; my $seq = $ARGV[0] || 1; # Cycle thru and try it out for (@test) { my $form = CGI::FormBuilder->new( debug => $DEBUG, action => 'TEST', title => 'TEST', %{ $_->{opt} }, ); # the ${mod} key twiddles fields while(my($f,$o) = each %{$_->{mod} || {}}) { $o->{name} = $f; $form->field(%$o); } # # Just compare the output of render with what's expected # the correct string output is now in external files. # The seemingly extra eval is required so that failures # to import the template modules do not kill the tests. # (since render is called regardless of whether $SKIP is set) # my $out = outfile($seq++); my $ren = $SKIP ? '' : $form->render; my $ok = skip($SKIP, $ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } # MORE TESTS DOWN HERE # from eszpee for tmpl_param skip($SKIP, do{ my $form2 = CGI::FormBuilder->new( template => { type => 'Text', engine => {TYPE => 'STRING', SOURCE => '<% $test %>'} } ); $form2->tmpl_param(test => "this message should appear"); eval '$form2->render'; }, 'this message should appear'); CGI-FormBuilder-3.09/t/PaxHeader/2b-test00.html000644 777777 777777 00000000214 12246225402 021016 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715780 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2b-test00.html000644 €_$D€q{Ì00000001547 12246225402 017342 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit". <% $jshead %>

<% $start %><% $state %> Enter your name: <% $field{name}{field}.$field{name}{comment} %> Select your <% $field{color}{label} %>: <% my $ret = "$field{sex}{label} = "; for (@{$field{sex}{options}}) { $ret .= qq($_->[1]
); } $ret; %> FYI, your dress size is <% $field{size}{value}.$field{size}{comment} %>
<% $submit %> <% $end %> CGI-FormBuilder-3.09/t/PaxHeader/2b-test01.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715781 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2b-test01.html000644 €_$D€q{Ì00000002741 12246225402 017340 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: Select your Best Color: Sex = Male
Female
FYI, your dress size is 42
CGI-FormBuilder-3.09/t/PaxHeader/2b-test02.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715782 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2b-test02.html000644 €_$D€q{Ì00000001304 12246225402 017333 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: Fuck off Select your Mom: Fuck me?
= Yes
No
Maybe
FYI, your dress size is 8
CGI-FormBuilder-3.09/t/PaxHeader/2b-test03.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715783 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2b-test03.html000644 €_$D€q{Ì00000004155 12246225402 017343 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: Select your Color: glass EYE fucker = 2
4
6
FYI, your dress size is (unknown)
CGI-FormBuilder-3.09/t/PaxHeader/2c-template-tt2.t000644 777777 777777 00000000214 12246226374 021532 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715784 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2c-template-tt2.t000644 €_$D€q{Ì00000010741 12246226374 020052 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) 2000-2006 Nathan Wiger . # All Rights Reserved. If you're reading this, you're bored. # 2c-template-tt2.t - test Template AssKit support use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded our $SKIP; BEGIN { my $numtests = 4; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # try to load template engine so absent template does # not cause all tests to fail eval "require Template"; $SKIP = $@ ? 'skip: Template Toolkit not installed here' : 0; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # Create our template and store it in a scalarref my $template = outfile(0); # What options we want to use, and what we expect to see my @test = ( { opt => { fields => [qw/name color/], submit => 'No esta una button del resetto', template => { type => 'TT2', template => \$template, variable => 'form' }, validate => { name => 'NAME' }, }, mod => { color => { options => [qw/red green blue/], label => 'Best Color', value => 'red' }, size => { value => 42 }, sex => { options => [[M=>'Male'],[F=>'Female']] } }, }, { opt => { fields => [qw/name color size/], template => { type => 'TT2', template => \$template, variable => 'form' }, values => {color => [qw/purple/], size => 8}, submit => 'Start over, boob!', }, mod => { color => { options => [[white=>'White'],[black=>'Black'],[red=>'Green']], label => 'Mom', }, name => { size => 80, maxlength => 80, comment => 'Fuck off' }, sex => { options => [[1=>'Yes'], [0=>'No'], [-1=>'Maybe']], label => 'Fuck me?
' }, }, }, { opt => { fields => [qw/name color email/], submit => [qw/Update Delete/], reset => 0, template => { type => 'TT2', template => \$template, variable => 'form' }, values => {color => [qw/yellow green orange/]}, validate => { sex => [qw(1 3 5)] }, }, mod => { color => {options => [[red => 1], [blue => 2], [yellow => 3], [pink => 4]] }, size => {comment => '(unknown)', value => undef, force => 1 } , sex => {label => 'glass EYE fucker', options => [[1,2],[3,4],[5,6]] }, }, }, { opt => { fields => [qw/yomomma mymomma/], submit => [qw/Remove Dance_With/], reset => 1, template => { type => 'TT2', template => \$template, variable => 'form' }, values => {mymomma => [qw/medium large xxl/]}, validate => { yomomma => 'NAME' }, }, mod => {}, }, ); # Perl 5 is sick sometimes. @test = @test[$ARGV[0] - 1] if @ARGV; my $seq = $ARGV[0] || 1; # Cycle thru and try it out for (@test) { my $form = CGI::FormBuilder->new( debug => $DEBUG, action => 'TEST', title => 'TEST', %{ $_->{opt} }, ); # the ${mod} key twiddles fields for my $f ( sort keys %{$_->{mod} || {}} ) { my $o = $_->{mod}{$f}; $o->{name} = $f; $form->field(%$o); } # # Just compare the output of render with what's expected # the correct string output is now in external files. # The seemingly extra eval is required so that failures # to import the template modules do not kill the tests. # (since render is called regardless of whether $SKIP is set) # my $out = outfile($seq++); my $ren = $SKIP ? '' : $form->render; my $ok = skip($SKIP, $ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } CGI-FormBuilder-3.09/t/PaxHeader/2c-test00.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715785 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2c-test00.html000644 €_$D€q{Ì00000001363 12246225402 017337 0ustar00nateware000000 000000 [% form.title %] [% form.jshead %] [% form.start %] [% FOREACH field = form.fields %] [% END %]
[% field.required ? "$field.label" : field.label %] [% IF field.invalid %] Missing or invalid entry, please try again.
[% END %] [% field.field %]
[% form.submit %] [% form.reset %]
[% form.end %] CGI-FormBuilder-3.09/t/PaxHeader/2c-test01.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715786 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2c-test01.html000644 €_$D€q{Ì00000004661 12246225402 017344 0ustar00nateware000000 000000 TEST
Name
Best Color
Sex
Size
CGI-FormBuilder-3.09/t/PaxHeader/2c-test02.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715787 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2c-test02.html000644 €_$D€q{Ì00000003251 12246225402 017337 0ustar00nateware000000 000000 TEST
Name
Mom
Size
Fuck me?
CGI-FormBuilder-3.09/t/PaxHeader/2c-test03.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715788 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2c-test03.html000644 €_$D€q{Ì00000006544 12246225402 017350 0ustar00nateware000000 000000 TEST
Name
Color
Email
glass EYE fucker
Size
CGI-FormBuilder-3.09/t/PaxHeader/2c-test04.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715789 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2c-test04.html000644 €_$D€q{Ì00000004017 12246225402 017342 0ustar00nateware000000 000000 TEST
Yomomma
Mymomma
CGI-FormBuilder-3.09/t/PaxHeader/2d-template-fast.t000644 777777 777777 00000000214 12246226374 021757 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715790 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2d-template-fast.t000644 €_$D€q{Ì00000013057 12246226374 020302 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 2d-template-fast.t - test CGI::FastTemplate support use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded our $SKIP; BEGIN { my $numtests = 4; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # try to load template engine so absent template does # not cause all tests to fail eval "require CGI::FastTemplate"; $SKIP = $@ ? 'skip: CGI::FastTemplate not installed here' : 0; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # Create our template and store it in a scalarref my $template = <<'EOT'; User Info Please update your info and hit "Submit". $JS_HEAD $START_FORM $FIELDS $SUBMIT $FORM_END EOT my $fieldtmpl = <<'EOT'; $LABEL$FIELD $COMMENT EOT my $fieldinv = <<'EOT'; $LABEL$FIELD $COMMENT $ERROR EOT # What options we want to use, and what we expect to see my @test = ( { opt => { fields => [qw/name color/], submit => 'No esta una button del resetto', template => { type => 'Fast', define_nofile => { form => $template, field => $fieldinv, field_invalid => $fieldinv, } }, validate => { name => 'NAME' }, }, mod => { color => { options => [qw/red green blue/], label => 'Best Color', value => 'red' }, size => { value => 42 }, sex => { options => [[M=>'Male'],[F=>'Female']] } }, }, { opt => { fields => [qw/name color size/], template => { type => 'Fast', define_nofile => { form => $template, field => $fieldinv, field_invalid => $fieldinv, } }, values => {color => [qw/purple/], size => 8}, submit => 'Start over, boob!', }, mod => { color => { options => [[white=>'White'],[black=>'Black'],[red=>'Green']], label => 'Mom', }, name => { size => 80, maxlength => 80, comment => 'Fuck off' }, sex => { options => [[1=>'Yes'], [0=>'No'], [2=>'Maybe']], label => 'Fuck me?
' }, }, }, { opt => { fields => [qw/name color email/], submit => [qw/Update Delete/], reset => 0, template => { type => 'Fast', define_nofile => { form => $template, field => $fieldinv, field_invalid => $fieldinv, } }, values => {color => [qw/yellow green orange/]}, validate => { sex => [qw(1 3 5)] }, }, mod => { color => {options => [[red => 1], [blue => 2], [yellow => 3], [pink => 4]] }, size => {comment => '(unknown)', value => undef, force => 1 } , sex => {label => 'glass EYE fucker', options => [[1,2],[3,4],[5,6]] }, }, }, ); # Perl 5 is sick sometimes. @test = @test[$ARGV[0] - 1] if @ARGV; my $seq = $ARGV[0] || 1; # Cycle thru and try it out for (@test) { my $form = CGI::FormBuilder->new( debug => $DEBUG, action => 'TEST', title => 'TEST', %{ $_->{opt} }, ); # the ${mod} key twiddles fields while(my($f,$o) = each %{$_->{mod} || {}}) { $o->{name} = $f; $form->field(%$o); } # # Just compare the output of render with what's expected # the correct string output is now in external files. # The seemingly extra eval is required so that failures # to import the template modules do not kill the tests. # (since render is called regardless of whether $SKIP is set) # my $out = outfile($seq++); my $ren; eval '$ren = $form->render'; warn $@ if $@ && ! $SKIP; my $ok = skip($SKIP, $ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } # MORE TESTS DOWN HERE # from eszpee for tmpl_param skip($SKIP, do{ my $form2 = CGI::FormBuilder->new( template => { type => 'Fast', define_nofile => { form => '$TEST', } }, ); $form2->tmpl_param(TEST => "this message should appear"); eval '$form2->render'; }, 'this message should appear'); CGI-FormBuilder-3.09/t/PaxHeader/2d-test01.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715791 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2d-test01.html000644 €_$D€q{Ì00000003651 12246225402 017343 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".
Name Best Color Sex Size CGI-FormBuilder-3.09/t/PaxHeader/2d-test02.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715792 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2d-test02.html000644 €_$D€q{Ì00000002257 12246225402 017345 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit". Name Fuck off Mom Size Fuck me?
CGI-FormBuilder-3.09/t/PaxHeader/2d-test03.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715793 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2d-test03.html000644 €_$D€q{Ì00000005421 12246225402 017342 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit". Name Color Email glass EYE fucker Size (unknown) CGI-FormBuilder-3.09/t/PaxHeader/2e-template-ssi.t000644 777777 777777 00000000214 12246226374 021621 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715794 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-template-ssi.t000644 €_$D€q{Ì00000011115 12246226374 020135 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 2e-template-ssi.t - test CGI::SSI support use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded our $SKIP; BEGIN { my $numtests = 5; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # try to load template engine so absent template does # not cause all tests to fail eval "require CGI::SSI"; $SKIP = $@ ? 'skip: CGI::SSI not installed here' : 0; # eval failed, skip all tests # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # Grab our template from our test00.html file my $template = outfile(0); my $kurtlidl = outfile(99); # What options we want to use, and what we expect to see my @test = ( { opt => { fields => [qw/name color/], submit => 0, reset => 'No esta una button del submito', template => { type=>'CGI_SSI', string => $template }, validate => { name => 'NAME' }, }, mod => { color => { options => [qw/red green blue/], nameopts => 1 }, size => { value => 42 } }, }, { opt => { fields => [qw/name color size/], template => { type=>'CGI_SSI', string => $template }, values => {color => [qw/purple/], size => 8}, reset => 'Start over, boob!', validate => {}, # should be empty }, mod => { color => { options => [qw/white black other/] }, name => { size => 80 } }, }, { opt => { fields => [qw/name color email/], submit => [qw/Update Delete/], reset => 0, template => { type=>'CGI_SSI', string => $template }, values => {color => [qw/yellow green orange/]}, validate => { color => [qw(red blue yellow pink)] }, }, mod => { color => {options => [[red => 1], [blue => 2], [yellow => 3], [pink => 4]] }, size => {value => '(unknown)' } }, }, { opt => { fields => [qw/field1 field2/], method => 'post', title => 'test form page', header => 0, template => { type=>'CGI_SSI', string => $kurtlidl }, }, mod => { field1 => { value => 109, comment => 'Hello' }, field2 => { type => 'submit', value => "1 < 2 < 3", label => "Reefer", comment => 'goodbyE@' }, field3 => { type => 'button', value => "<>", comment => 'onSubmit' }, }, }, ); # Perl 5 is sick sometimes. @test = @test[$ARGV[0] - 1] if @ARGV; my $seq = $ARGV[0] || 1; # Cycle thru and try it out for (@test) { my $form = CGI::FormBuilder->new( debug => $DEBUG, action => 'TEST', title => 'TEST', %{ $_->{opt} }, ); # the ${mod} key twiddles fields while(my($f,$o) = each %{$_->{mod} || {}}) { $o->{name} = $f; $form->field(%$o); } # # Just compare the output of render with what's expected # the correct string output is now in external files. # The seemingly extra eval is required so that failures # to import the template modules do not kill the tests. # (since render is called regardless of whether $SKIP is set) # my $out = outfile($seq++); my $ren = $SKIP ? '' : $form->render; my $ok = skip($SKIP, $ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { #use Data::Dumper; #die Dumper($form); open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } # MORE TESTS DOWN HERE # from eszpee for tmpl_param skip($SKIP, do{ my $form2 = CGI::FormBuilder->new( template => { type=>'CGI_SSI', string => '' } ); $form2->tmpl_param(test => "this message should appear"); eval '$form2->render'; }, 'this message should appear'); CGI-FormBuilder-3.09/t/PaxHeader/2e-test00.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715795 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-test00.html000644 €_$D€q{Ì00000000556 12246225402 017344 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is
CGI-FormBuilder-3.09/t/PaxHeader/2e-test01.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715796 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-test01.html000644 €_$D€q{Ì00000002307 12246225402 017341 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is 42

CGI-FormBuilder-3.09/t/PaxHeader/2e-test02.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715797 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-test02.html000644 €_$D€q{Ì00000000657 12246225402 017350 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is 8
CGI-FormBuilder-3.09/t/PaxHeader/2e-test03.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715798 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-test03.html000644 €_$D€q{Ì00000003444 12246225402 017346 0ustar00nateware000000 000000 User Info Please update your info and hit "Submit".

Enter your name: FYI, your dress size is (unknown)
CGI-FormBuilder-3.09/t/PaxHeader/2e-test04.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715799 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-test04.html000644 €_$D€q{Ì00000001074 12246225402 017344 0ustar00nateware000000 000000 Test
test form page:

CGI-FormBuilder-3.09/t/PaxHeader/2e-test99.html000644 777777 777777 00000000214 12246225402 021043 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715800 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/2e-test99.html000644 €_$D€q{Ì00000001022 12246225402 017353 0ustar00nateware000000 000000 Test :

CGI-FormBuilder-3.09/t/PaxHeader/3a-source-file.t000644 777777 777777 00000000214 12246226374 021424 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715801 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-source-file.t000644 €_$D€q{Ì00000015711 12246226374 017746 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 3a-source-file.t - test C::FB::Source::File support use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded BEGIN { my $numtests = 20; unshift @INC, "$FindBin::Bin/../lib"; plan tests => $numtests; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Need to fake a request or else we stall $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE&action=Unsubscribe&name=Pete+Peteson&email=pete%40peteson.com&extra=junk'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Test; # For testing sortopts in test 18 sub refsort { $_[0] <=> $_[1] } sub getopts { return [99,9,8,83,7,73,6,61,66,5,4,104,3,2,10,1,101]; } # What options we want to use, and what we expect to see my @test = ( #1 { str => ' fields: name email sticky: 0 ', }, #2 { str => ' # comment fields: Upper: type: password Case: value: 3 values: Upper: 1 Case: 0 ', }, #3 { str => ' # test three fields: first_name last_name submit: Update reset: 0 ', }, #4 { str => ' fields: first_name last_name: type: text submit: Update reset: 0 header: 1 body: bgcolor: black ', }, #5 { str => ' # rewritten fields hash # as a set of values fields: email: required: 0 first_name: required: 1 values: first_name: Nate email: nate@wiger.org validate: email: EMAIL sticky: 0 ', }, #6 { # utilize our query_string to test stickiness str => ' fields: ticket user part_number method: post keepextras: 1 validate: ticket: /^\d+$/ submit: Update,Delete,Cancel ', }, #7 { # max it out, baby str => ' fields: supply, demand options: supply: 0=A,1=B,2=C,3,4,5,6,7=D,8=E,9=F demand: 0=A,1=B,2=C,3,4,5,6,7=D,8=E,9=F values: supply: 0,1,2,3,4 demand: 5,6,7,8,9 method: put title: Econ 101 header name: econ font: arial,helvetica,courier stylesheet: 1 fieldtype: select ', }, #8 { str => ' fields: db:name,db:type,db:tab,ux:user,ux:name static: 1 ', }, #9 { # single-line search thing ala Yahoo! str => "fields: search \r\n submit: Go \n\r reset: 0 \r table: 0", }, #10 { str => ' fields: hostname domain header: 1 # will come out (ticket,user) b/c of QUERY_STRING keepextras: user,ticket values: localhost,localdomain validate: hostname: HOST domain: DOMAIN ', }, #11 { str => ' fields: email: value: nate@wiger.org first_name: value: Nate validate: email: EMAIL required: first_name javascript: 0 ', }, #12 { str => ' fields: earth, wind, fire, water fieldattr: type: TEXT ', }, #13 { str => ' fields: earth wind columns: 1 fire water notafield options: wind: , , fire: &&MURDEROUS", &&HOT", &&WARM", &&COLD", &&CHILLY", &&OUT" values: water: >>&c0ld&<< earth: Wind >> fire: &&MURDEROUS", &&HOT" ', }, #14 - option maxing { str => ' fields: multiopt values: multiopt: 1,2,6,9 options: multiopt: 1 = One, 2 = Two , 3 = Three, 7 = Seven, 8 = Eight, 9 = Nine, 4 = Four, 5 = Five, 6 = Six, 10 = Ten sortopts: NUM, ', }, #15 - obscure features { str => ' fields: plain, jane, mane nameopts: 1 # Style is important stylesheet: /my/own/style.css styleclass: yo. body: ignore: me javascript: 0 jsfunc:// missing labels: plain:AAA jane: BBB options: mane: ratty,nappy,mr_happy selectnum: 0 title: Bobby header: On ', }, #16 { str => ' fields: name: comment: Hey buddy email: comment: No email >> address?? sticky: 0 ', }, #17 { str => ' fields: won: jsclick: taco_punch = 1, taco_salad = "yummy" too: options: 0,1,2 jsclick: this.salami.value = "delicious" columns: 1 many: options: 0,1,2,3,4,5,6,7,8,9 jsclick: this.ham.value = "it\'s a pig, man!" columns: 1 cb_input: type: checkbox label: Option options: active=Have this item active ', }, #18 { str => ' fields: refsort: sortopts: \&refsort options: \&getopts ', }, #19 - table attr and field columns { str => ' fields: a: options: 0,1,2,3 columns: 2 value: 1,2 b: options: 4,5,6,7,8,9 columns: 3 comment: Please fill these in c lalign: today table: border: 1 td: taco: beef align: right tr: valign: top th: ignore: this selectnum: 10 ', mod => { a => { options => [0..3], columns => 2, value => [1..2] }, b => { options => [4..9], columns => 3, comment => "Please fill these in" }, }, }, #20 - order.cgi from manpage (big) { str => ' name: order method: post fields: first_name last_name email send_me_emails: options: 1=Yes,0=No columns: 1 value: 0 address state: options: JS,IW,KS,UW,JS,UR,EE,DJ,HI,YK,NK,TY sortopts: NAME columns: 1 zipcode credit_card expiration header: 1, title: Finalize Your Order submit: Place Order, Cancel reset: 0 validate: email: EMAIL zipcode: ZIPCODE credit_card: CARD expiration: MMYY messages: form_invalid_text: You fucked up. Check it: form_required_text: Don\'t fuck up, it causes me work. Fuck,try again, ok? js_invalid_input: - Enter shit in the "%s" field required: ALL jsfunc: < {type => 'File', source => \"$_->{str}"}); $conf{action} = 'TEST'; my $form = CGI::FormBuilder->new(%conf); $form->{title} = 'TEST' unless $form->{title}; # just compare the output of render with what's expected my $ren = $form->render; my $out = outfile($seq++); my $ok = ok($ren, $out); if (! $ok && $LOGNAME eq 'nwiger') { open(O, ">/tmp/fb.1.html"); print O $out; close O; open(O, ">/tmp/fb.2.html"); print O $ren; close O; system "diff /tmp/fb.1.html /tmp/fb.2.html"; exit 1; } } CGI-FormBuilder-3.09/t/PaxHeader/3a-test01.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715802 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test01.html000644 €_$D€q{Ì00000000714 12246225402 017336 0ustar00nateware000000 000000
Name
Email
CGI-FormBuilder-3.09/t/PaxHeader/3a-test02.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715803 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test02.html000644 €_$D€q{Ì00000000744 12246225402 017342 0ustar00nateware000000 000000
Upper
Case
CGI-FormBuilder-3.09/t/PaxHeader/3a-test03.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715804 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test03.html000644 €_$D€q{Ì00000000752 12246225402 017342 0ustar00nateware000000 000000
First Name
Last Name
CGI-FormBuilder-3.09/t/PaxHeader/3a-test04.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715805 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test04.html000644 €_$D€q{Ì00000001142 12246225402 017335 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

First Name
Last Name
CGI-FormBuilder-3.09/t/PaxHeader/3a-test05.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715806 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test05.html000644 €_$D€q{Ì00000003571 12246225402 017346 0ustar00nateware000000 000000

Fields that are highlighted are required.

Email
First Name
CGI-FormBuilder-3.09/t/PaxHeader/3a-test06.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715807 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test06.html000644 €_$D€q{Ì00000004340 12246225402 017342 0ustar00nateware000000 000000

Fields that are highlighted are required.

Ticket
User
Part Number
CGI-FormBuilder-3.09/t/PaxHeader/3a-test07.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715808 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test07.html000644 €_$D€q{Ì00000003426 12246225402 017347 0ustar00nateware000000 000000 Content-type: text/html Econ 101

Econ 101

Supply
Demand
CGI-FormBuilder-3.09/t/PaxHeader/3a-test08.html000644 777777 777777 00000000214 12246225402 021026 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715809 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test08.html000644 €_$D€q{Ì00000001231 12246225402 017340 0ustar00nateware000000 000000
Db Name
Db Type
Db Tab
Ux User
Ux Name
CGI-FormBuilder-3.09/t/PaxHeader/3a-test09.html000644 777777 777777 00000000214 12246225402 021027 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715810 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test09.html000644 €_$D€q{Ì00000000372 12246225402 017346 0ustar00nateware000000 000000
Search
CGI-FormBuilder-3.09/t/PaxHeader/3a-test10.html000644 777777 777777 00000000214 12246225402 021017 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715811 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test10.html000644 €_$D€q{Ì00000004166 12246225402 017343 0ustar00nateware000000 000000 Content-type: text/html TEST

TEST

Fields that are highlighted are required.

Hostname
Domain
CGI-FormBuilder-3.09/t/PaxHeader/3a-test11.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715812 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test11.html000644 €_$D€q{Ì00000001103 12246225402 017330 0ustar00nateware000000 000000

Fields that are highlighted are required.

Email
First Name
CGI-FormBuilder-3.09/t/PaxHeader/3a-test12.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715813 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test12.html000644 €_$D€q{Ì00000001215 12246225402 017335 0ustar00nateware000000 000000
Earth
Wind
Fire
Water
CGI-FormBuilder-3.09/t/PaxHeader/3a-test13.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715814 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test13.html000644 €_$D€q{Ì00000003160 12246225402 017337 0ustar00nateware000000 000000
Earth
Wind
Fire
Water
CGI-FormBuilder-3.09/t/PaxHeader/3a-test14.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715815 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test14.html000644 €_$D€q{Ì00000001455 12246225402 017345 0ustar00nateware000000 000000
Multiopt
CGI-FormBuilder-3.09/t/PaxHeader/3a-test15.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715816 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test15.html000644 €_$D€q{Ì00000002065 12246225402 017344 0ustar00nateware000000 000000 Content-type: text/html Bobby

Bobby

AAA
BBB
Mane
CGI-FormBuilder-3.09/t/PaxHeader/3a-test16.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715817 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test16.html000644 €_$D€q{Ì00000000754 12246225402 017350 0ustar00nateware000000 000000
Name Hey buddy
Email No email >> address??
CGI-FormBuilder-3.09/t/PaxHeader/3a-test17.html000644 777777 777777 00000000214 12246225402 021026 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715818 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test17.html000644 €_$D€q{Ì00000003234 12246225402 017345 0ustar00nateware000000 000000
Won
Too
Many
Option
CGI-FormBuilder-3.09/t/PaxHeader/3a-test18.html000644 777777 777777 00000000214 12246225402 021027 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715819 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test18.html000644 €_$D€q{Ì00000001672 12246225402 017352 0ustar00nateware000000 000000
Refsort
CGI-FormBuilder-3.09/t/PaxHeader/3a-test19.html000644 777777 777777 00000000214 12246225402 021030 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715820 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test19.html000644 €_$D€q{Ì00000003501 12246225402 017344 0ustar00nateware000000 000000
A
B
Please fill these in
C
CGI-FormBuilder-3.09/t/PaxHeader/3a-test20.html000644 777777 777777 00000000214 12246225402 021020 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715821 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test20.html000644 €_$D€q{Ì00000017320 12246225402 017340 0ustar00nateware000000 000000 Content-type: text/html Finalize Your Order

Finalize Your Order

Don't fuck up it causes me work. Fuck try again ok?

First Name
Last Name
Email
Send Me Emails
Address
State
Zipcode
Credit Card
Expiration
CGI-FormBuilder-3.09/t/PaxHeader/3a-test21.html000644 777777 777777 00000000214 12246225402 021021 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715822 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test21.html000644 €_$D€q{Ì00000006367 12246225402 017352 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/3a-test22.html000644 777777 777777 00000000214 12246225402 021022 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715823 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test22.html000644 €_$D€q{Ì00000002404 12246225402 017337 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/3a-test23.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715824 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test23.html000644 €_$D€q{Ì00000003604 12246225402 017343 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/3a-test24.html000644 777777 777777 00000000214 12246225402 021024 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715825 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test24.html000644 €_$D€q{Ì00000000575 12246225402 017350 0ustar00nateware000000 000000
Favorite Color
CGI-FormBuilder-3.09/t/PaxHeader/3a-test25.html000644 777777 777777 00000000214 12246225402 021025 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715826 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test25.html000644 €_$D€q{Ì00000001665 12246225402 017352 0ustar00nateware000000 000000 TEST

TEST

Acct #:
Phone
Taco
Salad
CGI-FormBuilder-3.09/t/PaxHeader/3a-test26.html000644 777777 777777 00000000214 12246225402 021026 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715827 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test26.html000644 €_$D€q{Ì00000001660 12246225402 017346 0ustar00nateware000000 000000
Acct
Phone
Taco
Salad
CGI-FormBuilder-3.09/t/PaxHeader/3a-test27.html000644 777777 777777 00000000214 12246225402 021027 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715828 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test27.html000644 €_$D€q{Ì00000001077 12246225402 017351 0ustar00nateware000000 000000
Text1
Text2
Textthree
CGI-FormBuilder-3.09/t/PaxHeader/3a-test28.html000644 777777 777777 00000000214 12246225402 021030 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715829 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3a-test28.html000644 €_$D€q{Ì00000007136 12246225402 017354 0ustar00nateware000000 000000 TEST

TEST

1 error(s) were encountered with your submission. Please correct the fields highlighted below.

Full Name
Sex
It's one or the other
Favy Colour Select an option from this list
Choose just one, even if you have more than one
Things you love
CGI-FormBuilder-3.09/t/PaxHeader/3b-multi-page.t000644 777777 777777 00000000214 12246226374 021254 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715830 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3b-multi-page.t000644 €_$D€q{Ì00000011515 12246226374 017574 0ustar00nateware000000 000000 #!/usr/bin/perl # Copyright (c) Nate Wiger http://nateware.com. # All Rights Reserved. If you're reading this, you're bored. # 3b-multi-page.t - test C::FB::Multi support package Stub; sub new { return bless {}, shift } sub AUTOLOAD { 1 } package main; use strict; our $TESTING = 1; our $DEBUG = $ENV{DEBUG} || 0; our $LOGNAME = $ENV{LOGNAME} || ''; our $VERSION; BEGIN { $VERSION = '3.09'; } use Test; use FindBin; # use a BEGIN block so we print our plan before CGI::FormBuilder is loaded BEGIN { unshift @INC, "$FindBin::Bin/../lib"; my $numtests = 42; plan tests => $numtests; # success if we said NOTEST if ($ENV{NOTEST}) { ok(1) for 1..$numtests; exit; } } # Fake a submission request $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'ticket=111&user=pete&replacement=TRUE&action=Unsubscribe&name=Pete+Peteson&email=pete%40peteson.com&extra=junk&_submitted=1&blank=&two=&two=&_page=2&_submitted_p2=2'; use CGI::FormBuilder 3.09; use CGI::FormBuilder::Multi; use CGI::FormBuilder::Test; # separate forms my $form1 = { name => 'p1', title => 'Page 1', fields => [qw(name email phone address city state zip extra)], }; my $form2 = { name => 'p2', title => 'Numero Dos', fields => 'ticket', }; my $form3 = { name => 'p3', title => 'Tres Tacos', fields => [qw(replacement ticket action)], # undocumented hooks fieldopts => { replacement => { options => [qw(TRUE FALSE MAYBE)], value => 'FALSE', label => 'MikeZ is Da"Bomb"' }, ticket => { comment => 'master mister', value => '-1million', force => 1, }, action => { label => ' JackSUN ', value => "Your mom if I'm lucky", type => 'PASSWORD', misc => 'ellaneous', }, }, header => 1, }; my $multi = CGI::FormBuilder::Multi->new( $form1, $form2, $form3, header => 0, method => 'Post', action => '/page.pl', debug => $DEBUG, columns => 1, navbar => 0, ); my $form = $multi->form; ok($form->name, 'p2'); #1 ok($multi->page, 2); #2 ok($multi->pages, 3); #3 ok(--$multi->page, 1); #4 $form = $multi->form; ok($form->name, 'p1'); #5 ok($form->title, 'Page 1'); #6 ok(keys %{$form->field}, 8); #7 ok($form->field('email'), 'pete@peteson.com'); #8 ok($form->submitted, 0); # 9 ok($form->action, '/page.pl'); #10 ok($form->field('blank'), undef); #11 ok($multi->page++, 1); #12 ok($multi->page, 2); #13 ok($form = $multi->form); #14 ok(++$multi->page, $multi->pages); #15 ok($form = $multi->form); #16 ok(++$multi->page, $multi->pages+1); #17 eval { $form = $multi->form }; # should die ok($@); #18 ^^^ from die ok($multi->page = $multi->pages, 3); #19 ok($form = $multi->form); #20 ok($form->field('replacement'), 'TRUE'); # 21 # hack my $ren = $form->render; if ($LOGNAME eq 'nwiger') { open(REN, ">/tmp/fb.2.html"); print REN $ren; close(REN); } ok($ren, outfile(22)); #22 ok($form->field('action'), 'Unsubscribe'); #23 ok($form->field('ticket'), '-1million'); #24 ok(--$multi->page, 2); #25 ok($form = $multi->form); #26 ok($form->field('ticket'), 111); #27 ok($form->field('extra'), undef); #28 - not a form field ok($multi->page(1), 1); #29 ok($form = $multi->form); #30 ok($form->field('ticket'), undef); #31 - not a form field ok($form->field('extra'), 'junk'); #32 # Session twiddling - must use page 3 ok($multi->page(3), 3); #33 ok($form = $multi->form); #34 # Try to bootstrap CGI::Session and skip otherwise my $session; eval <<'EOE'; use Cwd; my $pwd = cwd; require CGI::Session; $session = CGI::Session->new("driver:File", undef, {Directory => $pwd}); EOE # Placeholders so code can continue $session ||= new Stub; our $NOSESSION = $@ ? 'skip: CGI::Session not installed here' : 0; skip($NOSESSION, $form->sessionid($session->id), $session->id); #35 # Trick ourselves into producing a header w/ cookie my $c; { local $TESTING = 0; ($c) = $form->header =~ /Set-Cookie: (\S+)/; } skip($NOSESSION, $c, '_sessionid='.$session->id.';'); #36 # Empty return value? $session->save_param($form) unless $NOSESSION; skip($NOSESSION, $session->param('ticket'), $form->field('ticket'));#37 skip($NOSESSION, $session->param('name'), $form->field('name')); #38 # reset name forcibly ok($form->field(name => 'name', value => 'Tater Salad', force => 1)); #39 skip($NOSESSION, $session->param('name', $form->field('name'))); #40 skip($NOSESSION, $session->param('name'), 'Tater Salad'); #41 skip($NOSESSION, $session->param('email'), undef); #42 # cleanup undef $session; system 'rm -f cgisess*'; CGI-FormBuilder-3.09/t/PaxHeader/3b-test22.html000644 777777 777777 00000000214 12246225402 021023 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780736 23 SCHILY.dev=16777220 23 SCHILY.ino=26715831 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/t/3b-test22.html000644 €_$D€q{Ì00000003127 12246225402 017343 0ustar00nateware000000 000000 Content-type: text/html Tres Tacos

Tres Tacos

MikeZ is Da"Bomb"
Ticket master mister
JackSUN
CGI-FormBuilder-3.09/pod/PaxHeader/Changes.pod000644 777777 777777 00000000214 12246226620 021106 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715725 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/pod/Changes.pod000644 €_$D€q{Ì00000041173 12246226620 017431 0ustar00nateware000000 000000 =head1 NAME Changes - Changes in FormBuilder 3.0, please also see the README =head1 COMPATIBILITY FormBuilder 3.x should be completely compatible with FormBuilder 2.x, with the singular exception that you can no longer use the shortcut autoload style of getting to fields: $form->field(name => 'category', options => \@opt); $form->category(options => \@opt); # WRONG In order to allow the second form, you must specify the C option to C. =head1 VERSION 3.06 Maintenance release with a couple new features: support for "charset: utf8" in C, add_before_option/add_after_option c/o Victor Porton, and support for HTML5 type names c/o Wolfgang Radke. =head1 VERSION 3.0501 Bugfix release to repair a memory leak and a few "other" field edge cases. =head1 VERSION 3.05 Just a short time after 3.04, several new features evolved very quickly: =head2 Fieldset support A new C option to C and a C
option to the C method can be used to organize your form into sections. Currently works with the built-in C<< >> and new C<<
>> renderer only, but template support is in the works. =head2 Div rendering In addition to the builtin C<<
>> rendering module, a new C
rendering template has been included as well. If you select this, you get a table-free form which you can manipulate using stylesheets: $form->new(template => {type => 'div'}); This provides a couple additional benefits, like separate divs for every submit button. =head2 Additional classes A couple additional CSS classes were added, wrapping around the fields as a unit for better styling. The C<<
>> tag now gets a C<.fb_form> style as well. =head2 Fixed HTML::Template support A couple bugs were introduced in 3.04 that have been fixed, and more tests added. =head1 VERSION 3.04 In addition to the below features, a new Catalyst FormBuilder plugin is available on CPAN, C<< Catalyst::Plugin::FormBuilder >>. =head2 New $form->prepare() method You can now use C<< $form->prepare() >> to get back an expanded hashref just before C<< $form->render() >> is called. This allows you to use FormBuilder with Catalyst or other frameworks more easily, where the rendering is done elsewhere: my %expansion = $form->prepare; This could be passed directly to, say, Template Toolkit without having to use FormBuilder's Template Toolkit support. =head2 New "inflate" option to field() This is used the convert fields on the fly into objects or other values. For example, you could convert a "date" field into a DateTime object. Nice patch from Mark Hedges, check it out. =head2 Turkish messages Thanks to Recai Oktas. =head2 Added "missing" property for fields This can be queried in templates. To see if a field is missing altogether, you can check "field.missing" or "missing-field" depending on your template engine of choice. =head2 Removal of custom C and C FormBuilder now uses C and C<@CARP_NOT> to handle its errors. As such, you will probably notice some differences in error output. The benefit is that setting C will give you a stack trace on fatal errors. =head2 CGI::FormBuilder::Template::Builtin Moved the C method to the above module, to unify the rendering schemes. =head2 New FORMBUILDER_DEBUG environment variable Setting this has the same effect as using the C option. =head2 Removal of excess documentation Removed all the stub docs from C and C to make CPAN happy. =head1 VERSION 3.0302 This is a bugfix release to repair these main items: - optgroups bugfix for complex arrays - removal of HTML::Entities support due to utf8 issues - new es_ES Messages module with better translations - a patch from Mark Hedges to enable plugin modules for mailresults() The rest of the features remain the same as below. =head1 VERSION 3.03 =head2 Subclassable Fields Each field is now rendered by its own class, named for the field type. For example, text fields are rendered by C. This allows you to create custom field types and plugging them in by creating your own C module. Thanks to Peter Eichman for his contributions to this scheme. =head2 Messages Localization All messages are now handled in a similar way to field types: They are delegated to C where "locale" is the appropriate string such as "en_US" or "da_DK". A number of localizations are included as part of the standard distribution. There are two ways to use these messages: Either the 'auto' messages mode or by specifying a specific locale: my $form = CGI::FormBuilder->new(messages => 'auto'); # check client my $form = CGI::FormBuilder->new(messages => ':da_DK'); # specified You can create your own messages by copying C<_example.pm> and modifying it for your language. When using messages in this way, the HTTP Charset is changed to C. =head2 Select optgroup support By using the C option C, you can now cause select fields to automatically generate optgroup tags: $form->field(name => 'browser', options => \@opt, optgroups => 1); See the documentation on C for more details. =head2 Data::FormValidator Support Thanks to another great patch from Peter Eichman, C is supported as a validation option to C, just by passing it in as an object. See the documentation on C for more information. =head2 Option sorting by LABELNAME or LABELNUM You can now sort options by C or C, similar to the value-based sorting of C and C. See the documentation for more details. =head2 XHTML Compliance Generated code now validates against L. This includes stuff like lowercase C and C methods, lowercase C and C actions, and so on. =head1 VERSION 3.02 =head2 Multi-Page Form Support A new module, C, has been added to handle the navigation and state of multi-page forms. A multi-page form is actually composed of several individual forms, tied together with the special CGI param C<_page>: my $multi = CGI::FormBuilder::Multi->new( # first args are hashrefs per-form \%form1_opts, \%form2_opts, \%form3_opts, # remaining options apply to all forms header => 1, method => 'POST', ); my $form = $multi->form; # current form if ($form->submitted && $form->validate) { # you write this do_data_update($form->fields); # last page? if ($multi->page == $multi->pages) { print $form->confirm; exit; } $multi->page++; # next page counter $form = $multi->form; # fetch next page's form } print $form->render; For more details, see L. =head2 External Source File Inspired by Peter Eichman's C, the new C option has been added to C which enables the use of an external config file to initialize B. This file takes the format: # sample config file method: POST header: 1 submit: Update, Delete fields: fname: label: First Name size: 50 validate: NAME lname: label: Last Name size: 40 validate: NAME sex: label: Gender options: M=Male, F=Female jsclick: javascript:alert("Change your mind??"); validate: M,F required: ALL messages: form_invalid_text: Please correct the following fields: form_required_text: Please fill in all bold fields. You can even pre-parse this file, and generate a module from it which you can then reuse in multiple scripts using the C function. For more details, see L. =head2 "Other" Fields The new C option has been added to C. If specified, a text box will be added to the right of the field, and its value will be used if the main field is not filled in. It will be subject to the same required and validation checks as the main field: $form->field(name => 'favorite_color', options => [qw(Red Green Blue)], validate => 'NAME', other => 1); # allow "other" This would create HTML something like this: Favorite Color: []Red []Green []Blue []Other: [____________] The text "Other:" is controlled by the message C. =head2 Growable Fields Thanks to a patch from Peter Eichman, C now also accepts a C option. This option enables some JavaScript hooks that add an "Additional [label]" button on text and file fields: Data File: [______________] [Additional Data File] When you click on the "Additional Data File" button, another box will be appended, allowing you to add more files. The values are then retrieved in the usual fashion: my @files = $form->field('data_file'); Like "other" fields, all elements are subject to validation checks. The text "Additional %s" is controlled by the message C. =head2 Support for C Thanks once again to Peter Eichman (busy guy), the module C has been included. This adds the template type C as an interface to C: my $form = CGI::FormBuilder->new( template => { type => 'Fast', define => { form => 'form.tmpl', field => 'field.tmpl', } } See L for more details. Thanks again Peter! =head2 Subclassable Templates and tmpl_param() The 2.x C method has been reimplemented finally. In addition, the included template modules are now completely subclassable, meaning that you can create an entire template engine with something like this: package My::HTML::Template; use CGI::FormBuilder::Template::HTML; use base 'CGI::FormBuilder::Template::HTML'; # new() is inherited sub render { my $self = shift; my $form = shift; # complete form object # do any special actions here $self->SUPER::render; } For more details, see L. =head2 Message Changes All messages were reworded to make them shorter and easier to read. The phrase "You must" was removed from all of them. To see the new messages, cut-and-paste this code: perl -MCGI::FormBuilder::Messages \ -e 'CGI::FormBuilder::Messages->messages' In addition, the C and C messages were not even being used, and field labels were not being properly highlighted on error. These problems have been fixed. =head2 Autoloaded Fields The 2.x feature of C<< $form->$fieldname() >> has been reimplemented, but using it requires the C option: my $form = CGI::FormBuilder->new(fields => \@f, fieldsubs => 1); Read the docs for some caveats. =head2 Disabled Form Similar to a static form, you can set C<< disabled => 1 >> in C or C to display a form with grayed-out input boxes. You can also set this on a per-field basis using C. =head2 Verbatim HTML Options If you want to include HTML in your field options, set C to 0 in C (for one field) or C (for all fields). =head2 Compatibility Methods For compatibility with other modules, B now includes C, C, C, and C. =head1 VERSION 3.01 This was a bugfix release, including the following changes: - fixed major problems with keepextras, including a reversed ismember test - added debug messages to keepextras and changed a few other debugs - added patch from Peter Eichman to fix scalar $field->tag and $field->tag_value - converted most all XHTML generation methods to only returning scalars - fixed the columns option which was totally broken for radio buttons - added a feature to plop in {border => 0} in columns as well - added the 2.x 'override' alias for field() 'force' which was missing - also added a 'defaults' alias for field() 'value' for CGI.pm happiness - more tests since there were way too many bugs In addition there were many documentation updates and changes. =head1 VERSION 3.00 =head2 Internals The internals have been completely rewritten, nearly from the ground up. All of the major functions have been split into methods, and objects have been created for the form, fields, messages, CGI params, and so on. Several new sub-modules have been created, including: CGI::FormBuilder::Field CGI::FormBuilder::Messages CGI::FormBuilder::Template CGI::FormBuilder::Template::HTML CGI::FormBuilder::Template::Text CGI::FormBuilder::Template::TT2 Many of these modules can be subclassed and overridden if desired. In addition, the template engine has been rewritten to allow "plugging in" of additional template modules, simply by specifying the name of the module to the 'template' option in new(). For more details, see the man pages for the individual modules above. =head2 Style Sheets Stylesheets are now generated if the C option is specified to B. This can either be C<1> to turn it on, or a full path to a style sheet to include. When used, all tags are then output with a C attribute, named C plus the name of the tag: my $form = CGI::FormBuilder->new( fields => [qw/name email/], styleclass => 'myFB', # default is "fb_" stylesheet => 1, # turn on style ); print $form->render; # HTML will include # # =head2 Compliant XHTML The output should be fully-compliant XHTML finally. Really. Maybe. =head2 Attributes and Field Objects Individual accessors have been added for every attribute that FormBuilder maintains. For example, here's a snippet of code to demonstrate: if ($form->stylesheet) { # loop thru fields, changing class for ($form->fields) { next if /_date$/; # skip fields named "XXX_date" # each field is a stringifiable object with accessors if ($_->options) { # has options $_->class('my_opt_style'); } else { # plain text box $_->class('my_text_style'); } } } This code checks to see if the C property has been set on the main C<$form>. If so, then it loops thru all the fields, skipping those named C. Of the remaining fields, those that have options have their C attribute changed to C, and those without options have it set to C. In addition, you can individually render every part of the form yourself. by calling the appropriate method. For example: print $form->header; # just the header print $form->script; # opening JavaScript print $form->title; # form title print $form->start; # opening tag for ($form->fields) { print $_->label; # each field's human label print $_->tag; # each field's tag } print $form->end; # closing tag For a complete list of accessors, see the documentation for both L and L. =head2 Messages Many messages have been reworded, and several new messages were added to make it easier to customize individual text. In addition, you can now specify messages to individual fields: $form->field(name => 'email', message => 'Please enter a valid email address'); For more details, see C. =head2 HTML::Entities encoding HTML character encoding is now dispatched to C, if available. This can be downloaded as part of the C module set on CPAN. =head2 Documentation Documentation has been updated and somewhat reorganized, which was long overdue. =head1 AUTHOR Copyright (c) L. All Rights Reserved. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. CGI-FormBuilder-3.09/pod/PaxHeader/INSTALL.pod000644 777777 777777 00000000214 12246225402 020641 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715726 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/pod/INSTALL.pod000644 €_$D€q{Ì00000001645 12246225402 017164 0ustar00nateware000000 000000 =head1 NAME INSTALL - how to install FormBuilder 3.0 =head1 DESCRIPTION To install in your root Perl tree: perl Makefile.PL make make test make install If you want to relocate it elsewhere, say for testing, you need to change several C variables: perl Makefile.PL PREFIX=~/lib \ INSTALLMAN1DIR=~/man/man1 \ INSTALLMAN3DIR=~/man/man3 \ INSTALLARCHLIB=~/lib \ INSTALLPRIVLIB=~/lib \ INSTALLSITELIB=~/lib \ INSTALLSITEARCH=~/lib Note: This is true for CPAN modules and is not specific to B. =head1 AUTHOR Copyright (c) L. All Rights Reserved. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. CGI-FormBuilder-3.09/pod/PaxHeader/README.pod000644 777777 777777 00000000214 12246225402 020470 xustar00nateware000000 000000 18 gid=1896053708 18 uid=1596212229 20 ctime=1385780796 20 atime=1385780796 23 SCHILY.dev=16777220 23 SCHILY.ino=26715727 18 SCHILY.nlink=1 CGI-FormBuilder-3.09/pod/README.pod000644 €_$D€q{Ì00000010540 12246225402 017005 0ustar00nateware000000 000000 =head1 NAME README - README for FormBuilder 3.0, please also see Changes =head1 DESCRIPTION I hate form generation and validation because the majority of the process is tedious and mindless. In addition to being boring, there is too much room for simple error, which could render your application insecure or just plain useless. So I wrote B to try and get rid rid of the stoopid parts, as well as take care of some tricky parts. As a result, you can build a complete application with something like this: use CGI::FormBuilder; # Assume we did a DBI query to get existing values my $dbval = $sth->fetchrow_hashref; # First create our form my $form = CGI::FormBuilder->new( fields => [qw(name email phone gender)], header => 1, method => 'POST', values => $dbval, validate => { email => 'EMAIL', phone => '/^1?-?\d{3}-?\d{3}-?\d{4}$/', }, required => 'ALL', stylesheet => '/path/to/style.css', ); # Change gender field to have options $form->field(name => 'gender', options => [qw(Male Female)] ); if ($form->submitted && $form->validate) { # Get form fields as hashref my $fields = $form->fields; # Do something to update your data (you would write this) do_data_update($fields->{name}, $fields->{email}, $fields->{phone}, $fields->{gender}); # Show confirmation screen print $form->confirm; } else { # Print out the form print $form->render; } That simple bit of code would print out an entire form, laid out in a table. Your default database values would be filled in from the DBI hashref. It would also handle stickiness across multiple submissions correctly, and it will also be able to tell if it's been submitted. Finally, it will do both JavaScript and server-side validation too. =head1 KEY FEATURES Here's the main stuff that I think is cool: =head2 Input field abstraction You simply define your fields and their values, and this module will take care of figuring out the rest. B will automatically generate the appropriate input fields (input, select, radio, etc), even changing any JavaScript actions appropriately. =head2 Easy handling of defaults Just specify a hash of values to use as the defaults for your fields. This will be searched case-insensitively and displayed in the form. What's more, if the user enters something via the CGI that overrides a default, when you use the C method to get the data you'll get the correct value. =head2 Correct stickiness Stickiness is a PITA. B correctly handles even multiple values selected in a multiple select list, integrated with proper handling of defaults. =head2 Multiple submit mode support Related to the above, B allows you to reliably tell whether the person clicked on the C or C button of your form, normally a big pain. =head2 Robust field validation Form validation sucks, and this is where B is a big help. It has tons of builtin patterns, and will even generate gobs of JavaScript validation code for you. You can specify your own regexps as well, and B will correctly check even multivalued inputs. =head2 Template driver support B can natively "drive" several major templating engines, including C, C