HTML-FormFu-1.00000755000764000764 012253555153 14153 5ustar00cafrankscafranks000000000000README100644000764000764 47512253555153 15102 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00 This archive contains the distribution HTML-FormFu, version 1.00: HTML Form Creation, Rendering and Validation Framework This software is copyright (c) 2013 by Carl Franks. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Changes100644000764000764 6462512253555153 15564 0ustar00cafrankscafranks000000000000HTML-FormFu-1.001.00 2013-12-16 - TT template files changed - update them if you use a local copy. Template file 'label_tag' renamed to 'label_element' - old file can be deleted. 'field' file changed. New 'errors' file. - TT no longer listed as a prerequisite. If you use the TT files, you must add 'Template' to your own app's prereqs. - Element::reCAPTCHA and Constraint::reCAPTCHA moved out to separate distribution. - HTML::FormFu::MultiForm moved out to separate distribution. - auto_container_class(), auto_label_class(), auto_comment_class(), auto_container_error_class(), auto_container_per_error_class(), auto_error_class() no longer have default values. See "RESTORING LEGACY HTML CLASSES" in HTML::FormFu docs to restore previous behaviour. - auto_label_class() no longer adds class to container. auto_label_class() now adds class to label tag. new auto_container_label_class() adds class to container. See "RESTORING LEGACY HTML CLASSES" in HTML::FormFu docs to restore previous behaviour. - auto_comment_class() no longer adds class to both container and comment. auto_comment_class() now only adds class to comment tag. new auto_container_comment_class() adds class to container. See "RESTORING LEGACY HTML CLASSES" in HTML::FormFu docs to restore previous behaviour. - Bug fix: param_value() form method now matches documented behaviour - returns undef when field has errors. (Reported by Hailin Hu). - New Element::Email and Element::URL HTML5 input fields. - Role::Element::Input has new datalist_options(), datalist_values(), datalist_id() and auto_datalist_id() methods to support HTML5 datalists. auto_datalist_id() is an inherited accessor which can be set on the Form, MultiForm, or Block. - Form and Elements has new title() attribute short-cut. - Constraint::Regex has new anchored() accessor. - New Input attribute accessors: placeholder(), pattern(), autocomplete(). - New Input boolean attribute accessors: autofocus(), multiple(), required(). - New Field inherited accessors: auto_container_per_error_class(), auto_error_container_class(), auto_error_container_per_error_class(), error_tag(), error_container_tag - Constraints have new experimental method fetch_error_message(). - All field elements have new method error_filename(). - default_args() now supports 'Block', 'Field', 'Input' pseudo-elements, '|' alternatives, and '+' and '-' ancestor modifiers. - New Czech (cs) I18N translation by Jan Grmela. - mk_inherited_accessors() now also creates a *_no_inherit() method. - Experimental new roles() form method. - form methods start(), end() now respect render_method - no longer force use of tt templates. - Bug fix: del_attribute() on empty attribute no longer sets the attribute. - All attribute accessors generated with mk_attrs() now have *_loc variants. - form methods start(), end() now respect render_method - no longer force use of tt templates. - Tests now always require Test::Aggregate::Nested. Re-enable aggregate tests on Win32. Don't run all tests twice under both aggregate and t/ (doh!) 0.09010 2012-10-05 - Internal changes - all Repeatable/nested_name munging is moved out of HTML::FormFu::Element::Repeatable into individual constraints 0.09009 2012-09-29 - Make sure object can('checked') before calling checked() (colinnewell) - Updated Repeatable control to update id_field on DBIC::Unique if present - ComboBox new get_select_field_nested_name(), get_text_field_nested_name() accessors. - Fieldset new legend_attributes() method. - New form_error_message_class() method. - Constraint 'when' callback now receives $constraint as 2nd argument. 0.09007 2012-01-23 - bump MooseX::Attribute::Chained version 0.09006 2012-01-23 - fixed deprecation warnings of MX::Attribute::Chained (bricas) - Added placeholder attributes for types Text and Textarea with L10N support. - Added L10N support for 'prefix' attributes for types Date and DateTime. - Added 'attributes' support to types Date and DateTime. 0.09005 2011-09-06 - bump version of prereq CGI to 3.37 to make all tests pass 0.09004 2011-08-26 - skip aggregate.t on Win32 - no functional changes to HTML::FormFu 0.09003_02 2011-08-25 - disable Test::Aggregate on Win32 0.09003_01 2011-05-11 - using Test::Aggregate for the test suite if installed tests finish now in seconds instead of minutes 0.09003 2011-05-10 - fixed regression in Model::HashRef introduced in 0.09000 0.09002 2011-03-21 - Hopefully fix IO::Interactive dependency properly 0.09001 2011-03-31 - Fix IO::Interactive dependency 0.09000 2011-03-29 - Codebase changed to use Moose - massive internal changes - any custom Elements, Constraints, etc will require changes. See advice on mailing list: http://www.mail-archive.com/html-formfu@lists.scsys.co.uk/msg02325.html Or ask for help on the mailing list: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu - Bug fix: was a fatal error when a value was submitted for Label element (code called delete_nested_hash_value instead of deleted_nested_hash_key). - Bug fix: RT#65728 Filter::Split shouldn't return a value if no value was submitted. - Bug fix: Element::Date now uses default() in preference to default_natural(). RT#65727 - DateTime elements, minutes and seconds have new 'interval' option. - Now only delete submitted value if there's no other field on the form with the same name. - load_config_file(stem) now honours the include path order, to mimic TT behaviour. 0.08002 2010-09-22 - Incompatible Change: removed all previously deprecated methods. - Incompatible Change: HTML::FormFu::QueryType::Catalyst File uploads under Catalyst no longer have copy_to(), link_to() and catalyst_upload() methods - Deprecated passing multiple arguments to many methods, where they were being implicitly converted to a hash-ref or array-ref. A warning is now issued. - Fix: Constraint::Equal with not(1) set no longer sets an error when both field values are empty strings. - Fix: An empty block with nested_name set, containing Label elements and no other fields, was causing the block's nested_name to be added to $form->valid(). RT #54967 - Constraints that inherit from HTML::FormFu::Constraint::_others have a new 'other_siblings' option, which auto-generates the 'others' list. - Constraint 'when' condition now supports new 'fields' and 'any_field' options. - Bumped required version of DateTime to 0.54 - needed to pass tests under Test::More 0.96. 0.07003 2010-08-02 - Fix: Group element now escapes each items attributes, label_attributes and container attributes (based on by patch by Jeff Dairiki). - Fix: If using default_natural, use default_datetime_args{set_time_zone} if it's also set (Radek). - Filter::HTMLScrubber extra functionality. - Update _merge_hashes() so it can also merge arrays and hashes into a new array. This is necessary to allow default_args() to define a different ref-type than the element or processor which uses its values. - Update Element::reCAPTCHA tests after changes to Captcha::reCAPTHCA (bump dependency version). 0.07002 2010-06-24 - Fix: Use MRO::Compat before mro to support perl 5.8 - Fix: Date and ComboBox elements need to run deflators before trying to use any default value - reported by Matija Grabnar. - Overloading comparisons no longer assume both arguments are a blessed object - change needed for latest Test::More (Test-Simple-0.95_02) (RT#57747) - Change Element::Date to not use deprecated DateTime::Locale methods. - Bump DateTime::Locale and DateTime::Format::Strptime required versions as DateTime::Locale Changes file has no mention of when the methods we're now using were added. - Removed Regexp::Copy from prereqs. 0.07001 2010-05-16 - No changes - cpan indexer failed for last release 0.07000 2010-05-16 - Change of behaviour: default_args() values are now applied to any object inheriting from the specified type, rather than just an instance of that type. Old behaviour is still supported with a minor change, see docs for details. - (Daniel Hilton) - Change of behaviour: default_args() key/values are now applied in order of inheritance, rather than the random order returned by keys() - New reverse_single attribute for all field elements. New reverse_group attribute for Checkboxgroup and Radiogroup elements. (Ronald Kimball) - New default_datetime_args() method on Date and DateTime elements. - Element::DateTime now supports a 'second' select menu. - Allow empty string as default value for Date element. (Ronald Kimball) - Now use Clone instead of Storable (ntyni@iki.fi). - Change from Class::C3 to mro, to get built-in support in perl >= 5.9 - New Bulgarian translation (Kamen Naydenov). - Fix bad links and markup in POD. (Ronald Kimball) - Fix spelling errors in POD (Ansgar Burchardt) - Documented Element::Textarea cols() and rows() methods. - Bump Config::Any requirement to version 0.18 for YAML::XS support - Refactored ObjectUtil (Daniel Hilton) 0.06001 2010-01-08 - Fixed issue with Model::HashRef where form fields with an underscore and overlapping name (e.g. 'foo' and 'foo_bar') were causing problems - Fix test suite year issue. 0.06000 2009-12-10 - New get_parent() method that traverses the parent hierarchy, returning the first parent that matches the supplied options. - Date element, year menu now supports 'reverse' option to reverse order of year list. - patch from Ozum Eldogan. - New Element::Block method auto_block_id(). - New only_on_reps() method for constraints on fields within a Repeatable element. Causes the constraint to only be run if the field's repeatable_count() matches one of the set values. - New Repeatable::Any constraint. - Bugfix: after submission, group-type fields were getting the wrong value when multiple fields had the same name. - patch by Doug Orleans. - Bugfix: If a field in a Repeatable block had an error, all copies of that field were displaying the error. - report by Doug Orleans. - Repeatable elements inside a Repeatable element, now works without having nested_name set. - Performance fix: change all uses of eval() to check for array/hash-refs to Scalar::Util::reftype() instead. - Was causing a hit for group-type fields with large numbers of options. - initial patch by Steve Nolte. - Bump required version of Data::Visitor to 0.26 - Minor pod fixes. 0.05004 2009-12-02 - No changes - last release was built on Windows and didn't pass pause's indexer checks. 0.05003 2009-11-29 - Fix YAML test files for YAML::XS compatibility 0.05002 2009-11-25 - Fix handling of counter_name in nested-repeatables. - Element::reCAPTCHA new constraint_args() method to pass options to the automatically-created Constraint::reCAPTCHA. - Model::HashRef->create() now works with submitted input. - Kwalitee updates. (RT #47998) - Pod fixes. (RT #49120, #49114, #46363) 0.05001 2009-07-03 - get_field(s), get_element(s), get_all_elements() now support a Regex object for any conditional argument. - Model::Hashref now searches for Multi and Repeatable elements using the regexes qr/Multi/ and qr/Repeatable/ to all for custom/derived classes. - New $form->add_localize_object_from_class() method. - New Element::Label. - Bugfix: DateTime element, hour/minute select menus didn't display correct value when hour/minute value was less than 10, and $form->process() wasn't called after $form->model->default_values(). - Silence "undef value in string eq" warnings. 0.05000 2009-05-26 - Nested repeatable blocks now create field names such as 'foo_1.bar_1' rather than 'foo.bar_1_1', to assist client-side scripting. 0.04002 2009-05-08 - Incompatible Change: Element::Repeatable->repeat() now defaults to 1 instead of 0. This allows empty Repeatables. - Fix test failures on Win32. - During Element::Repeatable->process() call children's process() before $self->repeat(). - Support nested Repeatable elements. - Ensure plugins are correctly cloned. 0.04001 2009-04-15 - Fix handling of arguments to plugin(). - HTML::FormFu::Model::HashRef supports now empty repeatable elements. - vertically-aligned CSS example updated. 0.04000 2009-03-26 - Incompatible Change: plugins process() method is now run *after* elements' process() method. - Incompatible Change: Button element no longer sets retain_default(1) - now sets force_default(1). Fixes bug where multiple buttons with same name were getting the wrong value after being redisplayed after errors. - New pre_process() plugin method that runs at the same time as the old process() hook. - New Model::HashRef. - New inherited method locale() available on forms, blocks and fields. - New Element::Number. - New Deflators: FormatNumber, PathClassFile, Callback. - New Filter::FormatNumber. - New Inflator::Callback. - New Norwegian I18N translation. - Updated vertically-aligned CSS. - config_file_path() now supports a list of directories. - Checkboxgroup + Radiogroup elements others() method now supports 'container_attributes' hash-key - Constraint when() condition no longer demands a 'value' or 'values' key - if it's missing, the constraint will pass on any true value. - Bugfix: _Group elements - ensure 'empty_first' gets set before any 'options', 'values', 'value_range'. - Bugfixes for constraint attach_errors_to_base(), attach_errors_to_others(). - Bugfix: Repeatable blocks now correctly rename nested-names in constraints' others(). - Bugfix: Repeatable blocks now rename field names in constraints' when(). - Bugfix: Repeatable blocks now reparent fields' plugins. 0.03007 2008-12-08 - Remove Test::Aggregate - seeing test failures under perl 5.8.x 0.03006 2008-12-03 - New DateTime element. - New MinRange, MaxRange, File::MinSize, File::MaxSize constraints to provide more specific error messages. - New File::Size constraint methods: min_kilobyte(), max_kilobyte(), min_megabyte(), max_megabyte(). - New config_file_path() method, used by load_config_file() and load_config_filestem(). - New field_order() method for Date elements. - New I18N translations for Romanian, Russian, Ukranian. - New MultiForm system for multi-page forms (not yet documented, file upload tests skipped due to test problems on MS Win32). - Length, Range and File::Size constraints now pass min() and max() values as I18N args, for use in strings. - DependOn and Equal constraints now pass the root field label as I18N arg, for use in strings. - Checkbox + Radio elements now default to value(1). - Constraint when() method now works with nested_names(). - Using test aggregate to speed-up tests. 0.03005 2008-09-08 - New ComboBox element. - Don't use Pod::Help - some people were getting test failures. 0.03004 2008-09-03 - New reCAPTCHA element. - New pt_br (Brazilian Portuguese) translation from Daniel Nicoletti. - New load_config_filestem() method for loading config files without having to specify the file extension. - New html_formfu_dumpconf.pl script, for viewing config files structure. - Assorted optimizations, providing over 20% runtime speedup. - Radio element now inherits from Checkbox, to remove duplicated code. - Radiogroup element now inherits from Checkboxgroup, to remove duplicated code. - checkboxgroup_tag template file has been removed - Checkboxgroup now just uses radiogroup_tag file. - All non-english I18N packages now correctly "use utf8;" - load_config_file() now switches on Config-General's UTF8, so that files are correctly decoded. - Regex filter now has an eval() method, which if true, eval's the contents of replace(), to allow the use of $1 variables or any other perl expression. - Allow languages() to be a single value, rather than just an arrayref. - CompoundJoin filter now ignores empty values. - examples/unicode updated. - Manual-Unicode cat. config examples changed to use MyApp->config(). - Stop warnings for undefined attributes - reported by Rod Taylor. - Documentation improvements by Ansgar Burchardt. 0.03003 2008-08-21 - Form and elements inside template files now have access to original object via self.object - Having a named Multi block within a Block with nested_name set, now works. - New Element method is_block() which is true for Block elements. - Multi no longers sets is_field(0) - it's now true for both is_field() and is_block(). - prereqs - set minimum version of Exporter.pm that exports import() 0.03002 2008-08-11 - Deprecate element_defaults() method. - New default_args() method. - New CompoundSprintf filter. - New DateTime constraint. - New field method default_empty_value(). - New I18N translations for Danish, French and Italian. - Added time_zone support to Inflator::DateTime - Documented that process() must be called before render() - this has been the case since 0.03000. 0.03001 2008-06-20 - Require version 0.38 of DateTime, for string overloading support. 0.03000 2008-06-19 - Field container_tag() now defaults to 'div' rather than 'span' to provide better layout without CSS. - Multi block no longer sets container_tag() to 'span' - defaults to 'div'. - HTML::FormFu::Model::DBIC moved out into a separate distribution. - Models now accessed through new form method: model(), with accompanying methods: default_model() and model_config. - Deprecated form methods: model_class(), defaults_from_model(), save_to_model(). - Model methods renamed to: default_model(), default_values() and update(). - New model method: create(). - Deprecated element method: db(). - Bugfixes for perl 5.10.0 (missing imports). - Bugfix: insert_before() and insert_after() now check if the object is already a child, and if so, removes it first. Reported by Ferruccio Zamuner. - Bugfix: update() many_to_many multi-value fields where 'default_column' included the table name (or 'me.') failed. - Bugfix: make inflators work with multiple submitted values. - Bugfix for Bool constraint: use '?' quantifier, not '*'. - Bugfix in Email constraint: ensure Email::Valid->address() is called in scalar context. - New Split and CompoundJoin filters. - New CompoundDateTime inflator. - New CompoundSplit and CompoundDateTime deflators. - New Plugin system (see tests, not yet documented) and StashValid plugin. - New form methods: stash_valid(), params_ignore_underscore() and tmp_upload_dir(). - New method for _Group fields: empty_first_label(). - Multi->render_data() now builds itself before it's children, so that deflators on the Multi work. - insert_before() and insert_after() now first removes the object if it's already a child of the target. - Callback filter and transformers now receive $params as a 2nd argument. - _Group field options() now supports value_xml, value_loc, label_xml and label_loc args. - get_* methods (fields, elements, constraints, etc) now accept any valid method-name as a search parameter. - add default_natural() method to Date element, allowing the use of DateTime::Format::Natural to parse dates such as "today" or "yesterday". - when() method for Constraints can now accept a callback - Transformer callbacks now get $params as second argument (as Constraints aready were getting) - Form method add_valid() now expects a full nested-name. - auto_id() now translates "%n" into the full nested-name. - Add a END block to DBICTestLib that cleans up the t/test.db 0.02004 2008-02-22 - Incompatible Change: $upload->headers no longer returns a hashref, it now returns a HTTP::Headers object. Tests for $upload->headers->{'Content-Type'} changed to $upload->headers->content_type. Tests for $upload->headers->{'Content-Length'} changed to $upload->headers->content_length. - Catalyst upload object now provides basename(), copy_to(), link_to(), size(), tempname() and type() methods which delegate to the Catalyst::Request::Upload object. - The original Catalyst::Request::Upload objects can be retrived with the catalyst_upload() method. - CGI and CGI::Simple upload objects provide size() and type() methods. - New Constraints: File::Size, File::MIME and File. - 'Required' and other constraints now work with file uploads. - Spanish I18N added. - Support for DBIx::Class schema methods which don't correspond to a database column or relationship. - Fixed test failures due to hardcoded date element output expecting the year 2007. - Fixed circular references in upload objects. 0.02003 2007-12-20 - Bugfix for has-many rels in defaults_from_model() - Added Template.pm back into prereqs - Repeatable element, increment_field_names() is now true by default - Fixed javascript rendering in _Field 0.02002 2007-12-12 - Fixes required for perl 5.10.0 0.02001 2007-12-12 - Bugfix for save_to_model() in HTML::FormFu::Model::DBIC 0.02000 2007-12-12 - New HTML::FormFu::Model::DBIC module to replace DBIx::Class::HTML::FormFu - New Repeatable block element - New "nested" params support. Form and Block elements have a new nested_name() method. Field elements have new nested(), nested_name() and nested_names() methods. Doesn't require CGI::Expand or Catalyst::Plugin::NestedParams - Uses new "string" renderer by default - doesn't use template files, Generated markup still exactly the same, Set render_method("tt") to use the template files (old behaviour), render_class_args() renamed to tt_args(), Template files now installed into @INC path by File::ShareDir, INCLUDE_PATH no longer set by default - New Checkboxgroup element. Works much like Radiogroup, but with checkboxes - Support multiple yaml documents in a single file - calls populate() once for each document - Date element now uses names of the form "date_day" instead of "date.day", so as to not conflict with the new nested-params. This should only affect you if your client-side code (CSS, JS) references the field names - Group elements (Select, Radiogroup, Checkboxgroup) now support a 'label_loc' argument, to provide the item labels via localize() - *_loc() methods now accept an arrayref argument, to allowing setting in YAML config files - render() now returns a string, not an object. $form->render->start_form() must be changed to $form->start(), $form->render->end_form() must be changed to $form->end, $form->render->field('foo') must be changed to $form->get_field('foo'), $form->render->hidden_fields() must be changed to $form->hidden_fields() - Bugfix: OutputProcessor::Indent was indenting closing tag, when it's value was empty (RT 30239) - Bugfix: Objects were getting wrong parents during clone() and auto_fieldset() 0.01006 2007-10-23 - render_class_args->{INCLUDE_PATH} now defaults to 'root' if it's not set - previously was only set if the entire render_class_args hashref was empty - New StripWhitespace OutputProcessor - New CopyValue Filter - New Cookbook and Unicode manual pages - New unicode example Catalyst application - New portuguese I18N translation - Callback Filters, Constraints and Validators now accept a fully qualified subroutine name instead of a code-ref - Date element month names from DateTime::Locale are run through ucfirst - Documentation improvements - Bugfix: forced errors are now displayed 0.01005 2007-09-21 - New Indent "output processor" to pretty-print output - New force_default() method on fields - New when() method for all Constraints - Behaviour change for MinMaxFields Constraint 0.01004 2007-09-12 - New html_formfu_deploy.pl helper program - AutoSet Constraint now works with Select optgroups - Added vertically-aligned CSS example - Fix circular reference / memory leak - Documentations fixes / additions - require v0.7901 of DateTime::Format::Builder to fix memory leak 0.01003 2007-08-22 - Add missing prereq to Makefile.PL 0.01002 2007-08-22 - Fixed missing imports causing errors with perl 5.9.x 0.01001 2007-08-22 - First non-dev release - All Element names now follow CamelCase convention - Key format of I18N files changed - New Date element - Use Class::C3 instead of SUPER - Automatically set UTF-8 encoding on TT - Support for Template::Alloy instead of TT 0.01000_02 2007-07-02 - Updated templates in tt_files.pm - 0.01000_02 was out of date 0.01000_02 2007-07-02 - Added YAML::Syck to dependencies - Pod fix 0.01000_01 2007-06-29 - First CPAN dev release LICENSE100644000764000764 4365012253555153 15271 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00This software is copyright (c) 2013 by Carl Franks. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2013 by Carl Franks. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2013 by Carl Franks. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End dist.ini100644000764000764 344312253555153 15704 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00name = HTML-FormFu author = Carl Franks license = Perl_5 copyright_holder = Carl Franks copyright_year = 2013 version = 1.00 [Prereqs] perl = 5.008001 ; this is the lowest version of Exporter I can identify that exports import() ; it's bundled with perl 5.83 ; version 5.567 that ships with perl 5.82 is no good Exporter = 5.57 Carp = 0 Class::Accessor::Chained::Fast = 0 Class::MOP::Method = 0 Clone = 0.31 Config::Any = 0.18 ; 0.10 - supports multi-doc config files ; 0.18 - prefers YAML::XS for YAML Cwd = 0 Data::Visitor = 0.26 ; when it dumped Any::Moose for Moose Data::Visitor::Callback = 0 Date::Calc = 0 DateTime = 0.54 ; required for string overloading DateTime::Format::Strptime = 1.2000 DateTime::Format::Builder = 0.7901 ; fixes memory leaks DateTime::Format::Natural = 0 DateTime::Locale = 0.45 Email::Valid = 0 Encode = 0 Fatal = 0 File::Copy = 0 File::Find = 0 File::ShareDir = 0 File::Spec = 0 File::Temp = 0 Hash::Flatten = 0 HTML::Scrubber = 0 HTML::TokeParser::Simple = 3.14 HTTP::Headers = 1.64 IO::File = 0 List::MoreUtils = 0 List::Util = 0 Locale::Maketext = 0 Module::Pluggable = 0 Moose = 1.00 ; Reasonable default until we get test results Moose::Role = 0 Moose::Util = 0 MooseX::Aliases = 0 MooseX::Attribute::Chained = 1.0.1 MooseX::SetOnce = 0 Number::Format = 0 Readonly = 0 Regexp::Common = 0 Path::Class::File = 0 Scalar::Util = 0 Storable = 0 Task::Weaken = 0 ; to ensure Scalar::Util was built with weaken() YAML::XS = 0.32 [Prereqs / TestRequires] CGI = 3.37 ; for file POST tests POSIX = 0 Test::More = 0.92 Test::Aggregate::Nested = 0.371 Test::Exception = 0 [MetaNoIndex] directory = examples [Test::Perl::Critic] [PodCoverageTests] [PodSyntaxTests] [PkgVersion] [NextRelease] format = %v %{yyyy-MM-dd}d [Repository] [@Basic] META.yml100644000764000764 311112253555153 15501 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00--- abstract: 'HTML Form Creation, Rendering and Validation Framework' author: - 'Carl Franks ' build_requires: CGI: 3.37 POSIX: 0 Test::Aggregate::Nested: 0.371 Test::Exception: 0 Test::More: 0.92 configure_requires: ExtUtils::MakeMaker: 6.30 File::ShareDir::Install: 0.03 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.133380' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: HTML-FormFu no_index: directory: - examples requires: Carp: 0 Class::Accessor::Chained::Fast: 0 Class::MOP::Method: 0 Clone: 0.31 Config::Any: 0.18 Cwd: 0 Data::Visitor: 0.26 Data::Visitor::Callback: 0 Date::Calc: 0 DateTime: 0.54 DateTime::Format::Builder: 0.7901 DateTime::Format::Natural: 0 DateTime::Format::Strptime: 1.2000 DateTime::Locale: 0.45 Email::Valid: 0 Encode: 0 Exporter: 5.57 Fatal: 0 File::Copy: 0 File::Find: 0 File::ShareDir: 0 File::Spec: 0 File::Temp: 0 HTML::Scrubber: 0 HTML::TokeParser::Simple: 3.14 HTTP::Headers: 1.64 Hash::Flatten: 0 IO::File: 0 List::MoreUtils: 0 List::Util: 0 Locale::Maketext: 0 Module::Pluggable: 0 Moose: 1.00 Moose::Role: 0 Moose::Util: 0 MooseX::Aliases: 0 MooseX::Attribute::Chained: v1.0.1 MooseX::SetOnce: 0 Number::Format: 0 Path::Class::File: 0 Readonly: 0 Regexp::Common: 0 Scalar::Util: 0 Storable: 0 Task::Weaken: 0 YAML::XS: 0.32 perl: 5.008001 resources: repository: git://github.com/fireartist/HTML-FormFu.git version: 1.00 MANIFEST100644000764000764 7673712253555153 15431 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00Changes LICENSE MANIFEST MANIFEST.SKIP META.yml Makefile.PL README bin/html_formfu_deploy.pl bin/html_formfu_dumpconf.pl dist.ini examples/unicode/Changes examples/unicode/Makefile.PL examples/unicode/README examples/unicode/database.sql examples/unicode/lib/unicode.pm examples/unicode/lib/unicode/Controller/Root.pm examples/unicode/lib/unicode/Model/DB.pm examples/unicode/lib/unicode/Schema.pm examples/unicode/lib/unicode/Schema/Unicode.pm examples/unicode/lib/unicode/View/TT.pm examples/unicode/lib/unicode/View/TT/Alloy.pm examples/unicode/root/favicon.ico examples/unicode/root/formfu/block examples/unicode/root/formfu/checkboxgroup examples/unicode/root/formfu/checkboxgroup_tag examples/unicode/root/formfu/content_button examples/unicode/root/formfu/end_block examples/unicode/root/formfu/end_form examples/unicode/root/formfu/field examples/unicode/root/formfu/form examples/unicode/root/formfu/input examples/unicode/root/formfu/input_tag examples/unicode/root/formfu/label examples/unicode/root/formfu/multi examples/unicode/root/formfu/non_block examples/unicode/root/formfu/recaptcha examples/unicode/root/formfu/repeatable examples/unicode/root/formfu/select_tag examples/unicode/root/formfu/start_block examples/unicode/root/formfu/start_form examples/unicode/root/formfu/textarea_tag examples/unicode/root/forms/index.yml examples/unicode/root/forms/view.conf examples/unicode/root/forms/view.yml examples/unicode/root/index.tt examples/unicode/root/static/images/btn_120x50_built.png examples/unicode/root/static/images/btn_120x50_built_shadow.png examples/unicode/root/static/images/btn_120x50_powered.png examples/unicode/root/static/images/btn_120x50_powered_shadow.png examples/unicode/root/static/images/btn_88x31_built.png examples/unicode/root/static/images/btn_88x31_built_shadow.png examples/unicode/root/static/images/btn_88x31_powered.png examples/unicode/root/static/images/btn_88x31_powered_shadow.png examples/unicode/root/static/images/catalyst_logo.png examples/unicode/root/vertically-aligned.css examples/unicode/root/view.tt examples/unicode/script/unicode_cgi.pl examples/unicode/script/unicode_create.pl examples/unicode/script/unicode_fastcgi.pl examples/unicode/script/unicode_server.pl examples/unicode/script/unicode_test.pl examples/unicode/t/01app.t examples/unicode/t/02pod.t examples/unicode/t/03podcoverage.t examples/unicode/t/model_DB.t examples/unicode/t/view_TT-Alloy.t examples/unicode/t/view_TT.t examples/unicode/unicode.db examples/unicode/unicode.yml examples/vertically-aligned-css/test.jpg examples/vertically-aligned-css/vertically-aligned-ie.css examples/vertically-aligned-css/vertically-aligned.css examples/vertically-aligned-css/vertically-aligned.html examples/vertically-aligned-css/vertically-aligned.pl examples/vertically-aligned-css/vertically-aligned.tt examples/vertically-aligned-css/vertically-aligned.yml lib/HTML/FormFu.pm lib/HTML/FormFu/Attribute.pm lib/HTML/FormFu/Constants.pm lib/HTML/FormFu/Constraint.pm lib/HTML/FormFu/Constraint/ASCII.pm lib/HTML/FormFu/Constraint/AllOrNone.pm lib/HTML/FormFu/Constraint/AutoSet.pm lib/HTML/FormFu/Constraint/Bool.pm lib/HTML/FormFu/Constraint/Callback.pm lib/HTML/FormFu/Constraint/CallbackOnce.pm lib/HTML/FormFu/Constraint/DateTime.pm lib/HTML/FormFu/Constraint/DependOn.pm lib/HTML/FormFu/Constraint/Email.pm lib/HTML/FormFu/Constraint/Equal.pm lib/HTML/FormFu/Constraint/File.pm lib/HTML/FormFu/Constraint/File/MIME.pm lib/HTML/FormFu/Constraint/File/MaxSize.pm lib/HTML/FormFu/Constraint/File/MinSize.pm lib/HTML/FormFu/Constraint/File/Size.pm lib/HTML/FormFu/Constraint/Integer.pm lib/HTML/FormFu/Constraint/Length.pm lib/HTML/FormFu/Constraint/MaxLength.pm lib/HTML/FormFu/Constraint/MaxRange.pm lib/HTML/FormFu/Constraint/MinLength.pm lib/HTML/FormFu/Constraint/MinMaxFields.pm lib/HTML/FormFu/Constraint/MinRange.pm lib/HTML/FormFu/Constraint/Number.pm lib/HTML/FormFu/Constraint/Printable.pm lib/HTML/FormFu/Constraint/Range.pm lib/HTML/FormFu/Constraint/Regex.pm lib/HTML/FormFu/Constraint/Repeatable/Any.pm lib/HTML/FormFu/Constraint/Required.pm lib/HTML/FormFu/Constraint/Set.pm lib/HTML/FormFu/Constraint/SingleValue.pm lib/HTML/FormFu/Constraint/Word.pm lib/HTML/FormFu/Deflator.pm lib/HTML/FormFu/Deflator/Callback.pm lib/HTML/FormFu/Deflator/CompoundDateTime.pm lib/HTML/FormFu/Deflator/CompoundSplit.pm lib/HTML/FormFu/Deflator/FormatNumber.pm lib/HTML/FormFu/Deflator/PathClassFile.pm lib/HTML/FormFu/Deflator/Strftime.pm lib/HTML/FormFu/Deploy.pm lib/HTML/FormFu/Element.pm lib/HTML/FormFu/Element/Blank.pm lib/HTML/FormFu/Element/Block.pm lib/HTML/FormFu/Element/Button.pm lib/HTML/FormFu/Element/Checkbox.pm lib/HTML/FormFu/Element/Checkboxgroup.pm lib/HTML/FormFu/Element/ComboBox.pm lib/HTML/FormFu/Element/ContentButton.pm lib/HTML/FormFu/Element/Date.pm lib/HTML/FormFu/Element/DateTime.pm lib/HTML/FormFu/Element/Email.pm lib/HTML/FormFu/Element/Fieldset.pm lib/HTML/FormFu/Element/File.pm lib/HTML/FormFu/Element/Hidden.pm lib/HTML/FormFu/Element/Hr.pm lib/HTML/FormFu/Element/Image.pm lib/HTML/FormFu/Element/Label.pm lib/HTML/FormFu/Element/Multi.pm lib/HTML/FormFu/Element/Number.pm lib/HTML/FormFu/Element/Password.pm lib/HTML/FormFu/Element/Radio.pm lib/HTML/FormFu/Element/Radiogroup.pm lib/HTML/FormFu/Element/Repeatable.pm lib/HTML/FormFu/Element/Reset.pm lib/HTML/FormFu/Element/Select.pm lib/HTML/FormFu/Element/SimpleTable.pm lib/HTML/FormFu/Element/Src.pm lib/HTML/FormFu/Element/Submit.pm lib/HTML/FormFu/Element/Text.pm lib/HTML/FormFu/Element/Textarea.pm lib/HTML/FormFu/Element/URL.pm lib/HTML/FormFu/Exception.pm lib/HTML/FormFu/Exception/Constraint.pm lib/HTML/FormFu/Exception/Inflator.pm lib/HTML/FormFu/Exception/Input.pm lib/HTML/FormFu/Exception/Transformer.pm lib/HTML/FormFu/Exception/Validator.pm lib/HTML/FormFu/FakeQuery.pm lib/HTML/FormFu/Filter.pm lib/HTML/FormFu/Filter/Callback.pm lib/HTML/FormFu/Filter/CompoundJoin.pm lib/HTML/FormFu/Filter/CompoundSprintf.pm lib/HTML/FormFu/Filter/CopyValue.pm lib/HTML/FormFu/Filter/Encode.pm lib/HTML/FormFu/Filter/FormatNumber.pm lib/HTML/FormFu/Filter/HTMLEscape.pm lib/HTML/FormFu/Filter/HTMLScrubber.pm lib/HTML/FormFu/Filter/LowerCase.pm lib/HTML/FormFu/Filter/NonNumeric.pm lib/HTML/FormFu/Filter/Regex.pm lib/HTML/FormFu/Filter/Split.pm lib/HTML/FormFu/Filter/TrimEdges.pm lib/HTML/FormFu/Filter/UpperCase.pm lib/HTML/FormFu/Filter/Whitespace.pm lib/HTML/FormFu/I18N.pm lib/HTML/FormFu/I18N/bg.pm lib/HTML/FormFu/I18N/cs.pm lib/HTML/FormFu/I18N/da.pm lib/HTML/FormFu/I18N/de.pm lib/HTML/FormFu/I18N/en.pm lib/HTML/FormFu/I18N/es.pm lib/HTML/FormFu/I18N/fr.pm lib/HTML/FormFu/I18N/hu.pm lib/HTML/FormFu/I18N/it.pm lib/HTML/FormFu/I18N/ja.pm lib/HTML/FormFu/I18N/no.pm lib/HTML/FormFu/I18N/pt_br.pm lib/HTML/FormFu/I18N/pt_pt.pm lib/HTML/FormFu/I18N/ro.pm lib/HTML/FormFu/I18N/ru.pm lib/HTML/FormFu/I18N/ua.pm lib/HTML/FormFu/I18N/zh_cn.pm lib/HTML/FormFu/Inflator.pm lib/HTML/FormFu/Inflator/Callback.pm lib/HTML/FormFu/Inflator/CompoundDateTime.pm lib/HTML/FormFu/Inflator/DateTime.pm lib/HTML/FormFu/Literal.pm lib/HTML/FormFu/Localize.pm lib/HTML/FormFu/Manual/Cookbook.pod lib/HTML/FormFu/Manual/Unicode.pod lib/HTML/FormFu/Model.pm lib/HTML/FormFu/Model/HashRef.pm lib/HTML/FormFu/ObjectUtil.pm lib/HTML/FormFu/OutputProcessor.pm lib/HTML/FormFu/OutputProcessor/Indent.pm lib/HTML/FormFu/OutputProcessor/StripWhitespace.pm lib/HTML/FormFu/Plugin.pm lib/HTML/FormFu/Plugin/StashValid.pm lib/HTML/FormFu/Preload.pm lib/HTML/FormFu/Processor.pm lib/HTML/FormFu/QueryType/CGI.pm lib/HTML/FormFu/QueryType/CGI/Simple.pm lib/HTML/FormFu/QueryType/Catalyst.pm lib/HTML/FormFu/Role/Constraint/Others.pm lib/HTML/FormFu/Role/ContainsElements.pm lib/HTML/FormFu/Role/ContainsElementsSharedWithField.pm lib/HTML/FormFu/Role/CreateChildren.pm lib/HTML/FormFu/Role/CustomRoles.pm lib/HTML/FormFu/Role/Element/Coercible.pm lib/HTML/FormFu/Role/Element/Field.pm lib/HTML/FormFu/Role/Element/FieldMethods.pm lib/HTML/FormFu/Role/Element/Group.pm lib/HTML/FormFu/Role/Element/Input.pm lib/HTML/FormFu/Role/Element/MultiElement.pm lib/HTML/FormFu/Role/Element/NonBlock.pm lib/HTML/FormFu/Role/Element/ProcessOptionsFromModel.pm lib/HTML/FormFu/Role/Element/SingleValueField.pm lib/HTML/FormFu/Role/Filter/Compound.pm lib/HTML/FormFu/Role/FormAndBlockMethods.pm lib/HTML/FormFu/Role/FormAndElementMethods.pm lib/HTML/FormFu/Role/FormBlockAndFieldMethods.pm lib/HTML/FormFu/Role/GetProcessors.pm lib/HTML/FormFu/Role/HasParent.pm lib/HTML/FormFu/Role/NestedHashUtils.pm lib/HTML/FormFu/Role/Populate.pm lib/HTML/FormFu/Role/Render.pm lib/HTML/FormFu/Transformer.pm lib/HTML/FormFu/Transformer/Callback.pm lib/HTML/FormFu/Upload.pm lib/HTML/FormFu/UploadParam.pm lib/HTML/FormFu/Util.pm lib/HTML/FormFu/Validator.pm lib/HTML/FormFu/Validator/Callback.pm share/templates/tt/xhtml/block share/templates/tt/xhtml/checkboxgroup share/templates/tt/xhtml/checkboxgroup_tag share/templates/tt/xhtml/content_button share/templates/tt/xhtml/end_block share/templates/tt/xhtml/end_form share/templates/tt/xhtml/errors share/templates/tt/xhtml/field share/templates/tt/xhtml/form share/templates/tt/xhtml/input share/templates/tt/xhtml/input_tag share/templates/tt/xhtml/label share/templates/tt/xhtml/label_element share/templates/tt/xhtml/multi share/templates/tt/xhtml/non_block share/templates/tt/xhtml/recaptcha share/templates/tt/xhtml/repeatable share/templates/tt/xhtml/select_tag share/templates/tt/xhtml/start_block share/templates/tt/xhtml/start_form share/templates/tt/xhtml/textarea_tag t-aggregate/01use.t t-aggregate/04basic.t t-aggregate/04basic.yml t-aggregate/05_repeated_render.t t-aggregate/block_insert_after.t t-aggregate/block_insert_before.t t-aggregate/bugs/constructor_arg_overwrites_default.t t-aggregate/bugs/date_element_deflator.t t-aggregate/bugs/date_element_empty_input.t t-aggregate/bugs/datetime_hour_lt_10.t t-aggregate/bugs/disabled_select_default_value.yml t-aggregate/bugs/element_class.t t-aggregate/bugs/element_parent.t t-aggregate/bugs/empty_block_with_nested_name.t t-aggregate/bugs/empty_block_with_nested_name.yml t-aggregate/bugs/error_msg.t t-aggregate/bugs/error_multiple_fields_same_name.t t-aggregate/bugs/error_multiple_fields_same_name.yml t-aggregate/bugs/field_no_name.t t-aggregate/bugs/filter_run_once.t t-aggregate/bugs/multiple_checkbox_same_name.t t-aggregate/bugs/multiple_checkbox_same_name.yml t-aggregate/bugs/name_regex_chars.t t-aggregate/bugs/not_nested.t t-aggregate/bugs/populate_element_coderef.t t-aggregate/bugs/pre_1_00_compat.t t-aggregate/bugs/pre_1_00_compat.yml t-aggregate/bugs/render_processed_value_retain_default.t t-aggregate/bugs/render_processed_value_retain_default.yml t-aggregate/bugs/result_params_multiple.t t-aggregate/bugs/select_empty_options.t t-aggregate/bugs/submit_no_value.t t-aggregate/bugs/submit_retain_default.t t-aggregate/bugs/value_empty_string.t t-aggregate/bugs/value_no_default.t t-aggregate/bugs/yaml_utf8.t t-aggregate/bugs/yaml_utf8.txt t-aggregate/bugs/yaml_utf8.yml t-aggregate/constraints/allornone.t t-aggregate/constraints/allornone_attach_errors_to_base.t t-aggregate/constraints/allornone_attach_errors_to_base.yml t-aggregate/constraints/allornone_attach_errors_to_others.t t-aggregate/constraints/allornone_attach_errors_to_others.yml t-aggregate/constraints/ascii.t t-aggregate/constraints/autoset.t t-aggregate/constraints/autoset_group.t t-aggregate/constraints/bool.t t-aggregate/constraints/callback.t t-aggregate/constraints/callbackonce.t t-aggregate/constraints/constraint.t t-aggregate/constraints/constraint_other_siblings.t t-aggregate/constraints/constraint_other_siblings.yml t-aggregate/constraints/constraint_other_siblings_not.t t-aggregate/constraints/constraint_other_siblings_not.yml t-aggregate/constraints/constraint_when.t t-aggregate/constraints/constraint_when.yml t-aggregate/constraints/constraint_when_any_field.t t-aggregate/constraints/constraint_when_any_field.yml t-aggregate/constraints/constraint_when_any_true_value.t t-aggregate/constraints/constraint_when_any_true_value.yml t-aggregate/constraints/constraint_when_default_empty_value.t t-aggregate/constraints/constraint_when_default_empty_value.yml t-aggregate/constraints/constraint_when_fields.t t-aggregate/constraints/constraint_when_fields.yml t-aggregate/constraints/datetime_parser.t t-aggregate/constraints/dependon.t t-aggregate/constraints/dependon_attach_errors_to_base.t t-aggregate/constraints/dependon_attach_errors_to_base.yml t-aggregate/constraints/dependon_attach_errors_to_others.t t-aggregate/constraints/dependon_attach_errors_to_others.yml t-aggregate/constraints/email.t t-aggregate/constraints/equal.t t-aggregate/constraints/equal_internals.t t-aggregate/constraints/equal_not.t t-aggregate/constraints/file.t t-aggregate/constraints/file.yml t-aggregate/constraints/file_maxsize.t t-aggregate/constraints/file_maxsize.yml t-aggregate/constraints/file_mime.t t-aggregate/constraints/file_mime.yml t-aggregate/constraints/file_minsize.t t-aggregate/constraints/file_minsize.yml t-aggregate/constraints/file_size.t t-aggregate/constraints/file_size.yml t-aggregate/constraints/integer.t t-aggregate/constraints/length.t t-aggregate/constraints/localize.t t-aggregate/constraints/maxlength.t t-aggregate/constraints/maxrange.t t-aggregate/constraints/minlength.t t-aggregate/constraints/minmaxfields.t t-aggregate/constraints/minmaxfields_with_filter_split.t t-aggregate/constraints/minmaxfields_with_filter_split.yml t-aggregate/constraints/minrange.t t-aggregate/constraints/not_equal.t t-aggregate/constraints/not_word.t t-aggregate/constraints/number.t t-aggregate/constraints/printable.t t-aggregate/constraints/range.t t-aggregate/constraints/regex.t t-aggregate/constraints/regex_anchored.t t-aggregate/constraints/regex_common.t t-aggregate/constraints/repeatable_any.t t-aggregate/constraints/repeatable_any.yml t-aggregate/constraints/repeatable_any_not_increment_field_names.t t-aggregate/constraints/repeatable_any_not_increment_field_names.yml t-aggregate/constraints/required.t t-aggregate/constraints/required_file.t t-aggregate/constraints/required_file.yml t-aggregate/constraints/required_only_on_reps.t t-aggregate/constraints/required_only_on_reps.yml t-aggregate/constraints/set.t t-aggregate/constraints/singlevalue.t t-aggregate/constraints/word.t t-aggregate/constraints/xml.t t-aggregate/deflators/callback.t t-aggregate/deflators/compounddatetime.t t-aggregate/deflators/compounddatetime.yml t-aggregate/deflators/compounddatetime_field_order.t t-aggregate/deflators/compounddatetime_field_order.yml t-aggregate/deflators/compoundsplit.t t-aggregate/deflators/compoundsplit.yml t-aggregate/deflators/compoundsplit_after_submit.t t-aggregate/deflators/compoundsplit_after_submit.yml t-aggregate/deflators/compoundsplit_field_order.t t-aggregate/deflators/compoundsplit_field_order.yml t-aggregate/deflators/compoundsplit_split.t t-aggregate/deflators/compoundsplit_split.yml t-aggregate/deflators/formatnumber.t t-aggregate/deflators/formatnumber.yml t-aggregate/deflators/pathclassfile.t t-aggregate/elements/blank.t t-aggregate/elements/block.t t-aggregate/elements/block_auto_block_id.t t-aggregate/elements/block_auto_block_id.yml t-aggregate/elements/block_repeatable.t t-aggregate/elements/block_repeatable.yml t-aggregate/elements/block_repeatable_attrs.t t-aggregate/elements/block_repeatable_attrs.yml t-aggregate/elements/block_repeatable_auto_block_id.t t-aggregate/elements/block_repeatable_auto_block_id.yml t-aggregate/elements/block_repeatable_auto_id.t t-aggregate/elements/block_repeatable_auto_id.yml t-aggregate/elements/block_repeatable_date.t t-aggregate/elements/block_repeatable_date.yml t-aggregate/elements/block_repeatable_inc.t t-aggregate/elements/block_repeatable_inc.yml t-aggregate/elements/block_repeatable_multi.t t-aggregate/elements/block_repeatable_tag.t t-aggregate/elements/block_repeatable_tag.yml t-aggregate/elements/button.t t-aggregate/elements/button_no_name.t t-aggregate/elements/checkbox.t t-aggregate/elements/checkbox_force_default.t t-aggregate/elements/checkbox_retain_default.t t-aggregate/elements/checkbox_reverse.t t-aggregate/elements/checkbox_reverse.yml t-aggregate/elements/checkboxgroup.t t-aggregate/elements/checkboxgroup_attributes_escaped.t t-aggregate/elements/checkboxgroup_attributes_escaped.yml t-aggregate/elements/combobox.t t-aggregate/elements/combobox.yml t-aggregate/elements/combobox_repeatable.t t-aggregate/elements/combobox_repeatable.yml t-aggregate/elements/combobox_required.t t-aggregate/elements/combobox_required.yml t-aggregate/elements/content_button.t t-aggregate/elements/date.t t-aggregate/elements/date_default.t t-aggregate/elements/date_default_datetime_args.t t-aggregate/elements/date_default_datetime_args.yml t-aggregate/elements/date_default_empty.t t-aggregate/elements/date_month_year.t t-aggregate/elements/date_natural.t t-aggregate/elements/date_order.t t-aggregate/elements/date_order_error.t t-aggregate/elements/date_rename.t t-aggregate/elements/date_undef.t t-aggregate/elements/date_year_reverse.t t-aggregate/elements/date_year_reverse.yml t-aggregate/elements/datetime.t t-aggregate/elements/datetime.yml t-aggregate/elements/datetime_interval.t t-aggregate/elements/datetime_interval.yml t-aggregate/elements/datetime_seconds.t t-aggregate/elements/datetime_seconds.yml t-aggregate/elements/element_setup.t t-aggregate/elements/email.t t-aggregate/elements/errors_filename.t t-aggregate/elements/errors_filename.yml t-aggregate/elements/escaping.t t-aggregate/elements/field_default_empty_value.t t-aggregate/elements/field_non_param.t t-aggregate/elements/fieldset.t t-aggregate/elements/fieldset_legend_attrs.t t-aggregate/elements/fieldset_legend_attrs.yml t-aggregate/elements/file.t t-aggregate/elements/file_post.txt t-aggregate/elements/file_post_cgi_simple.t t-aggregate/elements/hidden.t t-aggregate/elements/hr.t t-aggregate/elements/image.t t-aggregate/elements/label.t t-aggregate/elements/label.yml t-aggregate/elements/label_value_submission.t t-aggregate/elements/label_value_submission.yml t-aggregate/elements/multi.t t-aggregate/elements/multi_errors.t t-aggregate/elements/multiple_submit_buttons.t t-aggregate/elements/no_block_tag.t t-aggregate/elements/no_block_tag.yml t-aggregate/elements/no_container_tag.t t-aggregate/elements/no_container_tag.yml t-aggregate/elements/number.t t-aggregate/elements/number.yml t-aggregate/elements/object.t t-aggregate/elements/object/input t-aggregate/elements/password.t t-aggregate/elements/password_render_value.t t-aggregate/elements/password_retain_default.t t-aggregate/elements/radio.t t-aggregate/elements/radio_force_default.t t-aggregate/elements/radio_retain_default.t t-aggregate/elements/radiogroup.t t-aggregate/elements/radiogroup_attributes_escaped.t t-aggregate/elements/radiogroup_attributes_escaped.yml t-aggregate/elements/radiogroup_attrs_xml.t t-aggregate/elements/radiogroup_dup_opt.t t-aggregate/elements/radiogroup_errors.t t-aggregate/elements/radiogroup_force_default.t t-aggregate/elements/radiogroup_id.t t-aggregate/elements/radiogroup_id_value.t t-aggregate/elements/radiogroup_retain_default.t t-aggregate/elements/radiogroup_subgroup.t t-aggregate/elements/radiogroup_unknown_opt.t t-aggregate/elements/radiogroup_xml.t t-aggregate/elements/render_method.t t-aggregate/elements/repeatable_counter_name.t t-aggregate/elements/repeatable_counter_name.yml t-aggregate/elements/repeatable_repeatable.t t-aggregate/elements/repeatable_repeatable.yml t-aggregate/elements/reset.t t-aggregate/elements/reverse.t t-aggregate/elements/select.t t-aggregate/elements/select_attributes_escaped.t t-aggregate/elements/select_attributes_escaped.yml t-aggregate/elements/select_deflator_default.t t-aggregate/elements/select_empty_first.t t-aggregate/elements/select_empty_first.yml t-aggregate/elements/select_empty_first_label.t t-aggregate/elements/select_force_default.t t-aggregate/elements/select_label_loc.t t-aggregate/elements/select_multi_default_values.t t-aggregate/elements/select_multi_value.t t-aggregate/elements/select_optgroup.t t-aggregate/elements/select_options.t t-aggregate/elements/select_retain_default.t t-aggregate/elements/select_same_name.t t-aggregate/elements/select_same_name.yml t-aggregate/elements/select_value_range.t t-aggregate/elements/simple_table.t t-aggregate/elements/simple_table.yml t-aggregate/elements/simple_table_class.t t-aggregate/elements/simple_table_class.yml t-aggregate/elements/simple_table_multiple.t t-aggregate/elements/simple_table_multiple.yml t-aggregate/elements/src.t t-aggregate/elements/submit.t t-aggregate/elements/text.t t-aggregate/elements/text_attributes.t t-aggregate/elements/text_auto_comment_class.t t-aggregate/elements/text_auto_comment_class.yml t-aggregate/elements/text_auto_container_class.t t-aggregate/elements/text_auto_container_class.yml t-aggregate/elements/text_auto_container_comment_class.t t-aggregate/elements/text_auto_container_comment_class.yml t-aggregate/elements/text_auto_container_error_class.t t-aggregate/elements/text_auto_container_error_class.yml t-aggregate/elements/text_auto_container_label_class.t t-aggregate/elements/text_auto_container_label_class.yml t-aggregate/elements/text_auto_label_class.t t-aggregate/elements/text_auto_label_class.yml t-aggregate/elements/text_datalist_options.t t-aggregate/elements/text_datalist_options.yml t-aggregate/elements/text_datalist_values.t t-aggregate/elements/text_datalist_values.yml t-aggregate/elements/text_errors.t t-aggregate/elements/text_force_default.t t-aggregate/elements/text_retain_default.t t-aggregate/elements/text_title.t t-aggregate/elements/textarea.t t-aggregate/elements/url.t t-aggregate/elements/url.yml t-aggregate/examples/custom_label.t t-aggregate/examples/custom_label2.t t-aggregate/examples/field_as.t t-aggregate/examples/fields_as_list_items.t t-aggregate/field_accessor_loc.t t-aggregate/field_accessor_loc_arrayref.t t-aggregate/field_accessor_loc_arrayref.yml t-aggregate/field_change_name.t t-aggregate/field_id.t t-aggregate/filters/all_by_default.t t-aggregate/filters/callback.t t-aggregate/filters/compoundjoin.t t-aggregate/filters/compoundjoin.yml t-aggregate/filters/compoundjoin_field_order.t t-aggregate/filters/compoundjoin_field_order.yml t-aggregate/filters/compoundjoin_join.t t-aggregate/filters/compoundjoin_join.yml t-aggregate/filters/compoundsprintf.t t-aggregate/filters/compoundsprintf.yml t-aggregate/filters/compoundsprintf_field_order.t t-aggregate/filters/compoundsprintf_field_order.yml t-aggregate/filters/copyvalue.t t-aggregate/filters/encode.t t-aggregate/filters/filter.t t-aggregate/filters/formatnumber.t t-aggregate/filters/formatnumber.yml t-aggregate/filters/htmlescape.t t-aggregate/filters/htmlscrubber.t t-aggregate/filters/lowercase.t t-aggregate/filters/nonnumeric.t t-aggregate/filters/regex.t t-aggregate/filters/regex.yml t-aggregate/filters/regex_eval.t t-aggregate/filters/regex_eval.yml t-aggregate/filters/split.t t-aggregate/filters/split.yml t-aggregate/filters/trimedges.t t-aggregate/filters/uppercase.t t-aggregate/filters/whitespace.t t-aggregate/force_errors/allornone.t t-aggregate/force_errors/callbackonce.t t-aggregate/force_errors/dependon.t t-aggregate/force_errors/equal.t t-aggregate/force_errors/force_errors.t t-aggregate/force_errors/integer.t t-aggregate/force_errors/minmaxfields.t t-aggregate/form/add_render_class_args.t t-aggregate/form/add_valid.t t-aggregate/form/add_valid_unknown.t t-aggregate/form/attributes.t t-aggregate/form/auto_constraint_class.t t-aggregate/form/auto_error_class.t t-aggregate/form/auto_error_message.t t-aggregate/form/auto_fieldset.t t-aggregate/form/auto_label.t t-aggregate/form/clone.t t-aggregate/form/config_callback.t t-aggregate/form/config_callback.yml t-aggregate/form/constraints_from_dbic.t t-aggregate/form/constraints_from_dbic_rs.t t-aggregate/form/default_args.t t-aggregate/form/default_args_alt.t t-aggregate/form/default_args_alt.yml t-aggregate/form/default_args_isa.t t-aggregate/form/default_args_isa.yml t-aggregate/form/default_args_not_inheriting.t t-aggregate/form/default_values.t t-aggregate/form/end.t t-aggregate/form/error_message.t t-aggregate/form/force_error_message.t t-aggregate/form/form_error_message_class.t t-aggregate/form/get_all_elements.t t-aggregate/form/get_constraint.t t-aggregate/form/get_constraints.t t-aggregate/form/get_deflator.t t-aggregate/form/get_deflators.t t-aggregate/form/get_element.t t-aggregate/form/get_elements.t t-aggregate/form/get_errors.t t-aggregate/form/get_field.t t-aggregate/form/get_fields.t t-aggregate/form/get_filter.t t-aggregate/form/get_filters.t t-aggregate/form/get_inflator.t t-aggregate/form/get_inflators.t t-aggregate/form/get_parent.t t-aggregate/form/get_parent.yml t-aggregate/form/has_errors.t t-aggregate/form/hidden_fields.t t-aggregate/form/init_arg.t t-aggregate/form/insert_after.t t-aggregate/form/insert_before.t t-aggregate/form/javascript.t t-aggregate/form/javascript_src.t t-aggregate/form/languages.t t-aggregate/form/languages.yml t-aggregate/form/model.t t-aggregate/form/multiple_same_named_fields.t t-aggregate/form/object.t t-aggregate/form/object/form t-aggregate/form/param.t t-aggregate/form/param_array.t t-aggregate/form/param_list.t t-aggregate/form/param_value.t t-aggregate/form/params.t t-aggregate/form/params_ignore_underscore.t t-aggregate/form/query.t t-aggregate/form/render_processed_value.t t-aggregate/form/render_processed_value.yml t-aggregate/form/start.t t-aggregate/form/stash.t t-aggregate/form/submitted.t t-aggregate/form/submitted_and_valid.t t-aggregate/form/title_xml.t t-aggregate/form/valid.t t-aggregate/i18n/add_localize_object.t t-aggregate/i18n/add_localize_object_from_class.t t-aggregate/i18n/add_localize_object_from_class.yml t-aggregate/inflators/array.t t-aggregate/inflators/callback.t t-aggregate/inflators/compounddatetime.t t-aggregate/inflators/compounddatetime.yml t-aggregate/inflators/compounddatetime_field_order.t t-aggregate/inflators/compounddatetime_field_order.yml t-aggregate/inflators/datetime_optional.t t-aggregate/inflators/datetime_parser.t t-aggregate/inflators/datetime_regex.t t-aggregate/inflators/datetime_regex_string.t t-aggregate/inflators/datetime_strptime.t t-aggregate/inflators/datetime_timezone.t t-aggregate/inflators/datetime_with_constraint.t t-aggregate/inflators/datetime_with_constraint.yml t-aggregate/internals/default_args-types.t t-aggregate/internals/default_args-types.yml t-aggregate/load_config/config_file_path.t t-aggregate/load_config/config_file_path/form.yml t-aggregate/load_config/config_file_path2/form.yml t-aggregate/load_config/load_config_file.t t-aggregate/load_config/load_config_file_constraint_regex.t t-aggregate/load_config/load_config_file_constraint_regex.yml t-aggregate/load_config/load_config_file_fieldset.yml t-aggregate/load_config/load_config_file_form.yml t-aggregate/load_config/load_config_file_multi_stream.t t-aggregate/load_config/load_config_file_multi_stream.yml t-aggregate/load_config/load_config_file_multiple.t t-aggregate/load_config/load_config_file_multiple.yml t-aggregate/load_config/load_config_file_multiple1.yml t-aggregate/load_config/load_config_file_multiple2.yml t-aggregate/load_config/load_config_filestem.t t-aggregate/model/hashref_create.t t-aggregate/model/hashref_create_repeatable_without_nestedname.t t-aggregate/model/hashref_create_repeatable_without_nestedname.yml t-aggregate/model/hashref_default_values.t t-aggregate/model/hashref_escaping.t t-aggregate/model/hashref_multi_within_rep.t t-aggregate/model/hashref_multi_within_rep.yml t-aggregate/model/hashref_process.t t-aggregate/multiple_select_fields.t t-aggregate/multiple_text_fields.t t-aggregate/nested/constraints/allornone.t t-aggregate/nested/constraints/callbackonce.t t-aggregate/nested/constraints/constraint_when.t t-aggregate/nested/constraints/constraint_when.yml t-aggregate/nested/constraints/dependon.t t-aggregate/nested/constraints/equal.t t-aggregate/nested/constraints/minmaxfields.t t-aggregate/nested/constraints/required.t t-aggregate/nested/element_name.t t-aggregate/nested/element_name.yml t-aggregate/nested/elements/block_repeatable_multi_named.t t-aggregate/nested/elements/block_repeatable_multi_named.yml t-aggregate/nested/elements/block_repeatable_multi_named_filter.t t-aggregate/nested/elements/block_repeatable_multi_named_filter.yml t-aggregate/nested/elements/block_without_name.t t-aggregate/nested/elements/block_without_name.yml t-aggregate/nested/elements/checkbox_force_default.t t-aggregate/nested/elements/checkbox_retain_default.t t-aggregate/nested/elements/combobox.t t-aggregate/nested/elements/date.t t-aggregate/nested/elements/multi.t t-aggregate/nested/elements/multi_named.t t-aggregate/nested/elements/radio.t t-aggregate/nested/elements/radio_force_default.t t-aggregate/nested/elements/radio_retain_default.t t-aggregate/nested/elements/radiogroup.t t-aggregate/nested/elements/radiogroup_force_default.t t-aggregate/nested/elements/radiogroup_retain_default.t t-aggregate/nested/elements/repeatable_repeatable.t t-aggregate/nested/elements/repeatable_repeatable.yml t-aggregate/nested/elements/select.t t-aggregate/nested/elements/select_force_default.t t-aggregate/nested/elements/select_retain_default.t t-aggregate/nested/elements/select_same_name.t t-aggregate/nested/elements/select_same_name.yml t-aggregate/nested/elements/text.t t-aggregate/nested/filters/regex.t t-aggregate/nested/form/render_processed_value.t t-aggregate/nested/form/render_processed_value.yml t-aggregate/nested/form_input.t t-aggregate/nested/illegal_name.t t-aggregate/nested/inflators/datetime_strptime.t t-aggregate/nested/internals/form_processed_params.t t-aggregate/nested/internals/hash_keys.t t-aggregate/nested/param.t t-aggregate/nested/params.t t-aggregate/nested/pre_expanded.t t-aggregate/nested/transformers/callback.t t-aggregate/nested/valid.t t-aggregate/nested/validators/callback.t t-aggregate/output_processors/indent.t t-aggregate/output_processors/indent_internals.t t-aggregate/output_processors/strip_whitespace.t t-aggregate/output_processors/strip_whitespace.yml t-aggregate/plugins/stashvalid.t t-aggregate/plugins/stashvalid.yml t-aggregate/plugins/stashvalid_on_field.t t-aggregate/plugins/stashvalid_on_field.yml t-aggregate/repeatable/clone.t t-aggregate/repeatable/clone.yml t-aggregate/repeatable/constraints/attach_errors_to.t t-aggregate/repeatable/constraints/attach_errors_to.yml t-aggregate/repeatable/constraints/equal.t t-aggregate/repeatable/constraints/equal.yml t-aggregate/repeatable/constraints/required.t t-aggregate/repeatable/constraints/required.yml t-aggregate/repeatable/constraints/required_not_increment_field_names.t t-aggregate/repeatable/constraints/required_not_increment_field_names.yml t-aggregate/repeatable/constraints/required_not_nested.t t-aggregate/repeatable/constraints/required_not_nested.yml t-aggregate/repeatable/constraints/when.t t-aggregate/repeatable/constraints/when.yml t-aggregate/repeatable/repeatable/constraints/repeatable_any.t t-aggregate/repeatable/repeatable/constraints/repeatable_any.yml t-aggregate/roles/block.t t-aggregate/roles/block.yml t-aggregate/roles/field.t t-aggregate/roles/field.yml t-aggregate/roles/form.t t-aggregate/roles/form.yml t-aggregate/transformers/callback.t t-aggregate/utils/append_xml_attribute.t t-aggregate/utils/has_xml_attribute.t t-aggregate/utils/remove_xml_attribute.t t-aggregate/validators/callback.t t-aggregate/validators/validator.t t/aggregate.t t/elements-file_post.t t/elements-file_post.txt t/lib/HTMLFormFu/DBICUniqueFake.pm t/lib/HTMLFormFu/ElementSetup.pm t/lib/HTMLFormFu/I18N.pm t/lib/HTMLFormFu/I18N/en.pm t/lib/HTMLFormFu/MyBlockRole.pm t/lib/HTMLFormFu/MyDeflator.pm t/lib/HTMLFormFu/MyFieldRole.pm t/lib/HTMLFormFu/MyFormRole.pm t/lib/HTMLFormFu/MyModel.pm t/lib/HTMLFormFu/MyObject.pm t/lib/HTMLFormFu/MyValidator.pm t/lib/HTMLFormFu/RegressLocalization.pm t/lib/HTMLFormFu/RegressLocalization/en.pm t/lib/HTMLFormFu/TestLib.pm t/lib/MyApp/Schema.pm t/lib/MyApp/Schema/Dongle.pm t/lib/MyApp/Schema/Person.pm t/nested-elements-file_post.t t/templates/errors_filename/errors t/templates/input Makefile.PL100644000764000764 744112253555153 16214 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00 use strict; use warnings; use 5.008001; use ExtUtils::MakeMaker 6.30; use File::ShareDir::Install; install_share dist => "share"; my %WriteMakefileArgs = ( "ABSTRACT" => "HTML Form Creation, Rendering and Validation Framework", "AUTHOR" => "Carl Franks ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30", "File::ShareDir::Install" => "0.03" }, "DISTNAME" => "HTML-FormFu", "EXE_FILES" => [ "bin/html_formfu_deploy.pl", "bin/html_formfu_dumpconf.pl" ], "LICENSE" => "perl", "NAME" => "HTML::FormFu", "PREREQ_PM" => { "Carp" => 0, "Class::Accessor::Chained::Fast" => 0, "Class::MOP::Method" => 0, "Clone" => "0.31", "Config::Any" => "0.18", "Cwd" => 0, "Data::Visitor" => "0.26", "Data::Visitor::Callback" => 0, "Date::Calc" => 0, "DateTime" => "0.54", "DateTime::Format::Builder" => "0.7901", "DateTime::Format::Natural" => 0, "DateTime::Format::Strptime" => "1.2000", "DateTime::Locale" => "0.45", "Email::Valid" => 0, "Encode" => 0, "Exporter" => "5.57", "Fatal" => 0, "File::Copy" => 0, "File::Find" => 0, "File::ShareDir" => 0, "File::Spec" => 0, "File::Temp" => 0, "HTML::Scrubber" => 0, "HTML::TokeParser::Simple" => "3.14", "HTTP::Headers" => "1.64", "Hash::Flatten" => 0, "IO::File" => 0, "List::MoreUtils" => 0, "List::Util" => 0, "Locale::Maketext" => 0, "Module::Pluggable" => 0, "Moose" => "1.00", "Moose::Role" => 0, "Moose::Util" => 0, "MooseX::Aliases" => 0, "MooseX::Attribute::Chained" => "v1.0.1", "MooseX::SetOnce" => 0, "Number::Format" => 0, "Path::Class::File" => 0, "Readonly" => 0, "Regexp::Common" => 0, "Scalar::Util" => 0, "Storable" => 0, "Task::Weaken" => 0, "YAML::XS" => "0.32" }, "TEST_REQUIRES" => { "CGI" => "3.37", "POSIX" => 0, "Test::Aggregate::Nested" => "0.371", "Test::Exception" => 0, "Test::More" => "0.92" }, "VERSION" => "1.00", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "CGI" => "3.37", "Carp" => 0, "Class::Accessor::Chained::Fast" => 0, "Class::MOP::Method" => 0, "Clone" => "0.31", "Config::Any" => "0.18", "Cwd" => 0, "Data::Visitor" => "0.26", "Data::Visitor::Callback" => 0, "Date::Calc" => 0, "DateTime" => "0.54", "DateTime::Format::Builder" => "0.7901", "DateTime::Format::Natural" => 0, "DateTime::Format::Strptime" => "1.2000", "DateTime::Locale" => "0.45", "Email::Valid" => 0, "Encode" => 0, "Exporter" => "5.57", "Fatal" => 0, "File::Copy" => 0, "File::Find" => 0, "File::ShareDir" => 0, "File::Spec" => 0, "File::Temp" => 0, "HTML::Scrubber" => 0, "HTML::TokeParser::Simple" => "3.14", "HTTP::Headers" => "1.64", "Hash::Flatten" => 0, "IO::File" => 0, "List::MoreUtils" => 0, "List::Util" => 0, "Locale::Maketext" => 0, "Module::Pluggable" => 0, "Moose" => "1.00", "Moose::Role" => 0, "Moose::Util" => 0, "MooseX::Aliases" => 0, "MooseX::Attribute::Chained" => "v1.0.1", "MooseX::SetOnce" => 0, "Number::Format" => 0, "POSIX" => 0, "Path::Class::File" => 0, "Readonly" => 0, "Regexp::Common" => 0, "Scalar::Util" => 0, "Storable" => 0, "Task::Weaken" => 0, "Test::Aggregate::Nested" => "0.371", "Test::Exception" => 0, "Test::More" => "0.92", "YAML::XS" => "0.32" ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); { package MY; use File::ShareDir::Install qw(postamble); } MANIFEST.SKIP100644000764000764 31012253555153 16104 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00# Don't know if it's getting kept ^lib\/HTML\/FormFu\/Filter\/Default\.pm$ # not ready yet ^t-aggregate\/multiform-misc\/file ^benchmarks\b ^examples\/client-side-constraint\b ^xt\/ ^\.perltidyrc$ t000755000764000764 012253555153 14337 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00aggregate.t100644000764000764 25612253555153 16575 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/tuse strict; use warnings; use Test::More; use Test::Aggregate::Nested; Test::Aggregate::Nested->new( { dirs => 't-aggregate', # verbose => 1, } )->run; templates000755000764000764 012253555153 16335 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/tinput100644000764000764 4612253555153 17517 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t/templatesHTML000755000764000764 012253555153 15406 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/libFormFu.pm100644000764000764 23752312253555153 17356 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTMLpackage HTML::FormFu; { $HTML::FormFu::VERSION = '1.00'; } use Moose; use MooseX::Attribute::Chained; with 'HTML::FormFu::Role::Render', 'HTML::FormFu::Role::CreateChildren', 'HTML::FormFu::Role::GetProcessors', 'HTML::FormFu::Role::ContainsElements', 'HTML::FormFu::Role::ContainsElementsSharedWithField', 'HTML::FormFu::Role::FormAndBlockMethods', 'HTML::FormFu::Role::FormAndElementMethods', 'HTML::FormFu::Role::FormBlockAndFieldMethods', 'HTML::FormFu::Role::NestedHashUtils', 'HTML::FormFu::Role::Populate', 'HTML::FormFu::Role::CustomRoles'; use HTML::FormFu::Attribute qw( mk_attrs mk_attr_accessors mk_output_accessors mk_inherited_accessors mk_inherited_merging_accessors ); use HTML::FormFu::Constants qw( $EMPTY_STR ); use HTML::FormFu::Constraint; use HTML::FormFu::Exception; use HTML::FormFu::FakeQuery; use HTML::FormFu::Filter; use HTML::FormFu::Inflator; use HTML::FormFu::Localize; use HTML::FormFu::ObjectUtil qw( form load_config_file load_config_filestem clone stash constraints_from_dbic parent _load_file ); use HTML::FormFu::Util qw( DEBUG DEBUG_PROCESS DEBUG_CONSTRAINTS debug require_class _get_elements xml_escape split_name _parse_args process_attrs _filter_components ); use Clone (); use List::Util qw( first ); use List::MoreUtils qw( any none uniq ); use Scalar::Util qw( blessed refaddr weaken reftype ); use Carp qw( croak ); use overload ( 'eq' => '_string_equals', '==' => '_object_equals', '""' => sub { return shift->render }, 'bool' => sub {1}, 'fallback' => 1, ); __PACKAGE__->mk_attr_accessors(qw( id action enctype method )); for my $name ( qw( _elements _output_processors _valid_names _plugins _models ) ) { has $name => ( is => 'rw', default => sub { [] }, lazy => 1, isa => 'ArrayRef', ); } has languages => ( is => 'rw', default => sub { ['en'] }, lazy => 1, isa => 'ArrayRef', traits => ['Chained'], ); has input => ( is => 'rw', default => sub { {} }, lazy => 1, isa => 'HashRef', traits => ['Chained'], ); has _processed_params => ( is => 'rw', default => sub { {} }, lazy => 1, isa => 'HashRef', ); has form_error_message_class => ( is => 'rw', default => 'form_error_message', lazy => 1, ); our @MULTIFORM_SHARED = (qw( javascript javascript_src indicator filename query_type force_error_message localize_class tt_module nested_name nested_subscript default_model tmp_upload_dir params_ignore_underscore )); for (@MULTIFORM_SHARED) { has $_ => ( is => 'rw', traits => ['Chained'], ); } has submitted => ( is => 'rw', traits => ['Chained'] ); has query => ( is => 'rw', traits => ['Chained'] ); has _auto_fieldset => ( is => 'rw' ); __PACKAGE__->mk_output_accessors(qw( form_error_message )); *elements = \&element; *constraints = \&constraint; *filters = \&filter; *deflators = \&deflator; *inflators = \&inflator; *validators = \&validator; *transformers = \&transformer; *output_processors = \&output_processor; *loc = \&localize; *plugins = \&plugin; *add_plugins = \&add_plugin; our $build_defaults = { action => '', method => 'post', filename => 'form', render_method => 'string', tt_args => {}, tt_module => 'Template', query_type => 'CGI', default_model => 'DBIC', localize_class => 'HTML::FormFu::I18N', auto_error_message => 'form_%s_%t', error_tag => 'span', }; sub BUILD { my ( $self, $args ) = @_; $self->populate($build_defaults); return; } sub auto_fieldset { my ( $self, $element_ref ) = @_; # if there's no arg, just return whether there's an auto_fieldset already return $self->_auto_fieldset if !$element_ref; # if the argument isn't a reference, assume it's just a "1" meaning true, # and use an empty hashref if ( !ref $element_ref ) { $element_ref = {}; } $element_ref->{type} = 'Fieldset'; $self->element($element_ref); $self->_auto_fieldset(1); return $self; } sub default_values { my ( $self, $default_ref ) = @_; for my $field ( @{ $self->get_fields } ) { my $name = $field->nested_name; next if !defined $name; next if !exists $default_ref->{$name}; $field->default( $default_ref->{$name} ); } return $self; } sub model { my ( $self, $model_name ) = @_; $model_name ||= $self->default_model; # search models already loaded for my $model ( @{ $self->_models } ) { return $model if $model->type =~ /\Q$model_name\E$/; } # class not found, try require-ing it my $class = $model_name =~ s/^\+// ? $model_name : "HTML::FormFu::Model::$model_name"; require_class($class); my $model = $class->new( { type => $model_name, parent => $self, } ); push @{ $self->_models }, $model; return $model; } sub process { my ( $self, $query ) = @_; $self->input( {} ); $self->_processed_params( {} ); $self->_valid_names( [] ); $self->clear_errors; $query ||= $self->query; if ( defined $query && !blessed($query) ) { $query = HTML::FormFu::FakeQuery->new( $self, $query ); } # save it for further calls to process() if ($query) { DEBUG && debug( QUERY => $query ); $self->query($query); } # run all elements pre_process() methods for my $elem ( @{ $self->get_elements } ) { $elem->pre_process; } # run all plugins pre_process() methods for my $plugin ( @{ $self->get_plugins } ) { $plugin->pre_process; } # run all elements process() methods for my $elem ( @{ $self->get_elements } ) { $elem->process; } # run all plugins process() methods for my $plugin ( @{ $self->get_plugins } ) { $plugin->process; } my $submitted; if ( defined $query ) { eval { my @params = $query->param }; croak "Invalid query object: $@" if $@; $submitted = $self->_submitted($query); } DEBUG_PROCESS && debug( SUBMITTED => $submitted ); $self->submitted($submitted); if ($submitted) { my %input; my @params = $query->param; for my $field ( @{ $self->get_fields } ) { my $name = $field->nested_name; next if !defined $name; next if none { $name eq $_ } @params; if ( $field->nested ) { # call in list context so we know if there's more than 1 value my @values = $query->param($name); my $value = @values > 1 ? \@values : $values[0]; $self->set_nested_hash_value( \%input, $name, $value ); } else { my @values = $query->param($name); $input{$name} = @values > 1 ? \@values : $values[0]; } } DEBUG && debug( INPUT => \%input ); # run all field process_input methods for my $field ( @{ $self->get_fields } ) { $field->process_input( \%input ); } $self->input( \%input ); $self->_process_input; } # run all plugins post_process methods for my $elem ( @{ $self->get_elements } ) { $elem->post_process; } for my $plugin ( @{ $self->get_plugins } ) { $plugin->post_process; } return; } sub _submitted { my ( $self, $query ) = @_; my $indicator = $self->indicator; my $code; if ( defined($indicator) && ref $indicator ne 'CODE' ) { DEBUG_PROCESS && debug( INDICATOR => $indicator ); $code = sub { return defined $query->param($indicator) }; } elsif ( !defined $indicator ) { my @names = uniq grep {defined} map { $_->nested_name } @{ $self->get_fields }; DEBUG_PROCESS && debug( 'no indicator, checking fields...' => \@names ); $code = sub { grep { defined $query->param($_) } @names; }; } else { $code = $indicator; } return $code->( $self, $query ); } sub _process_input { my ($self) = @_; $self->_build_params; $self->_process_file_uploads; $self->_filter_input; $self->_constrain_input; $self->_inflate_input if !@{ $self->get_errors }; $self->_validate_input if !@{ $self->get_errors }; $self->_transform_input if !@{ $self->get_errors }; $self->_build_valid_names; return; } sub _build_params { my ($self) = @_; my $input = $self->input; my %params; for my $field ( @{ $self->get_fields } ) { my $name = $field->nested_name; next if !defined $name; next if exists $params{$name}; next if !$self->nested_hash_key_exists( $self->input, $name ) && !$field->default_empty_value; my $input = $self->get_nested_hash_value( $self->input, $name ); if ( ref $input eq 'ARRAY' ) { # can't clone upload filehandles # so create new arrayref of values $input = [@$input]; } elsif ( !defined $input && $field->default_empty_value ) { $input = ''; } $self->set_nested_hash_value( \%params, $name, $input, $name ); } $self->_processed_params( \%params ); DEBUG_PROCESS && debug( 'PROCESSED PARAMS' => \%params ); return; } sub _process_file_uploads { my ($self) = @_; my @names = uniq grep {defined} map { $_->nested_name } grep { $_->isa('HTML::FormFu::Element::File') } @{ $self->get_fields }; if (@names) { my $query_class = $self->query_type; if ( $query_class !~ /^\+/ ) { $query_class = "HTML::FormFu::QueryType::$query_class"; } require_class($query_class); my $params = $self->_processed_params; my $input = $self->input; for my $name (@names) { next if !$self->nested_hash_key_exists( $input, $name ); my $values = $query_class->parse_uploads( $self, $name ); $self->set_nested_hash_value( $params, $name, $values ); } } return; } sub _filter_input { my ($self) = @_; my $params = $self->_processed_params; for my $filter ( @{ $self->get_filters } ) { my $name = $filter->nested_name; next if !defined $name; next if !$self->nested_hash_key_exists( $params, $name ); $filter->process( $self, $params ); } return; } sub _constrain_input { my ($self) = @_; my $params = $self->_processed_params; for my $constraint ( @{ $self->get_constraints } ) { DEBUG_CONSTRAINTS && debug( 'FIELD NAME' => $constraint->field->nested_name, 'CONSTRAINT TYPE' => $constraint->type, ); $constraint->pre_process; my @errors = eval { $constraint->process($params) }; DEBUG_CONSTRAINTS && debug( ERRORS => \@errors ); DEBUG_CONSTRAINTS && debug( '$@' => $@ ); if ( blessed $@ && $@->isa('HTML::FormFu::Exception::Constraint') ) { push @errors, $@; } elsif ($@) { push @errors, HTML::FormFu::Exception::Constraint->new; } for my $error (@errors) { if ( !$error->parent ) { $error->parent( $constraint->parent ); } if ( !$error->constraint ) { $error->constraint($constraint); } $error->parent->add_error($error); } } return; } sub _inflate_input { my ($self) = @_; my $params = $self->_processed_params; for my $inflator ( @{ $self->get_inflators } ) { my $name = $inflator->nested_name; next if !defined $name; next if !$self->nested_hash_key_exists( $params, $name ); next if any {defined} @{ $inflator->parent->get_errors }; my $value = $self->get_nested_hash_value( $params, $name ); my @errors; ( $value, @errors ) = eval { $inflator->process($value) }; if ( blessed $@ && $@->isa('HTML::FormFu::Exception::Inflator') ) { push @errors, $@; } elsif ($@) { push @errors, HTML::FormFu::Exception::Inflator->new; } for my $error (@errors) { $error->parent( $inflator->parent ) if !$error->parent; $error->inflator($inflator) if !$error->inflator; $error->parent->add_error($error); } $self->set_nested_hash_value( $params, $name, $value ); } return; } sub _validate_input { my ($self) = @_; my $params = $self->_processed_params; for my $validator ( @{ $self->get_validators } ) { my $name = $validator->nested_name; next if !defined $name; next if !$self->nested_hash_key_exists( $params, $name ); next if any {defined} @{ $validator->parent->get_errors }; my @errors = eval { $validator->process($params) }; if ( blessed $@ && $@->isa('HTML::FormFu::Exception::Validator') ) { push @errors, $@; } elsif ($@) { push @errors, HTML::FormFu::Exception::Validator->new; } for my $error (@errors) { $error->parent( $validator->parent ) if !$error->parent; $error->validator($validator) if !$error->validator; $error->parent->add_error($error); } } return; } sub _transform_input { my ($self) = @_; my $params = $self->_processed_params; for my $transformer ( @{ $self->get_transformers } ) { my $name = $transformer->nested_name; next if !defined $name; next if !$self->nested_hash_key_exists( $params, $name ); next if any {defined} @{ $transformer->parent->get_errors }; my $value = $self->get_nested_hash_value( $params, $name ); my (@errors) = eval { $transformer->process( $value, $params ) }; if ( blessed $@ && $@->isa('HTML::FormFu::Exception::Transformer') ) { push @errors, $@; } elsif ($@) { push @errors, HTML::FormFu::Exception::Transformer->new; } for my $error (@errors) { $error->parent( $transformer->parent ) if !$error->parent; $error->transformer($transformer) if !$error->transformer; $error->parent->add_error($error); } } return; } sub _build_valid_names { my ($self) = @_; my $params = $self->_processed_params; my $skip_private = $self->params_ignore_underscore; my @errors = $self->has_errors; my @names; my %non_param; for my $field ( @{ $self->get_fields } ) { my $name = $field->nested_name; next if !defined $name; next if $skip_private && $field->name =~ /^_/; if ( $field->non_param ) { $non_param{$name} = 1; } elsif ( $self->nested_hash_key_exists( $params, $name ) ) { push @names, $name; } } push @names, uniq grep { ref $params->{$_} ne 'HASH' } grep { !( $skip_private && /^_/ ) } grep { !exists $non_param{$_} } keys %$params; my %valid; CHECK: for my $name (@names) { for my $error (@errors) { next CHECK if $name eq $error; } $valid{$name}++; } my @valid = keys %valid; $self->_valid_names( \@valid ); return; } sub _hash_keys { my ( $hash, $subscript ) = @_; my @names; for my $key ( keys %$hash ) { if ( ref $hash->{$key} eq 'HASH' ) { push @names, map { $subscript ? "${key}[${_}]" : "$key.$_" } _hash_keys( $hash->{$key}, $subscript ); } elsif ( ref $hash->{$key} eq 'ARRAY' ) { push @names, map { $subscript ? "${key}[${_}]" : "$key.$_" } _array_indices( $hash->{$key}, $subscript ); } else { push @names, $key; } } return @names; } sub _array_indices { my ( $array, $subscript ) = @_; my @names; for my $i ( 0 .. $#{$array} ) { if ( ref $array->[$i] eq 'HASH' ) { push @names, map { $subscript ? "${i}[${_}]" : "$i.$_" } _hash_keys( $array->[$i], $subscript ); } elsif ( ref $array->[$i] eq 'ARRAY' ) { push @names, map { $subscript ? "${i}[${_}]" : "$i.$_" } _array_indices( $array->[$i], $subscript ); } else { push @names, $i; } } return @names; } sub submitted_and_valid { my ($self) = @_; return $self->submitted && !$self->has_errors; } sub params { my ($self) = @_; return {} if !$self->submitted; my @names = $self->valid; my %params; for my $name (@names) { my @values = $self->param($name); if ( @values > 1 ) { $self->set_nested_hash_value( \%params, $name, \@values ); } else { $self->set_nested_hash_value( \%params, $name, $values[0] ); } } return \%params; } sub param { my ( $self, $name ) = @_; croak 'param method is readonly' if @_ > 2; return if !$self->submitted; if ( @_ == 2 ) { return if !$self->valid($name); my $value = $self->get_nested_hash_value( $self->_processed_params, $name ); return if !defined $value; if ( ref $value eq 'ARRAY' ) { return wantarray ? @$value : $value->[0]; } else { return $value; } } # return a list of valid names, if no $name arg return $self->valid; } sub param_value { my ( $self, $name ) = @_; croak 'name parameter required' if @_ != 2; return undef if !$self->valid($name); # this is guaranteed to always return a single value my $value = $self->get_nested_hash_value( $self->_processed_params, $name ); return ref $value eq 'ARRAY' ? $value->[0] : $value; } sub param_array { my ( $self, $name ) = @_; croak 'name parameter required' if @_ != 2; # guaranteed to always return an arrayref return [] if !$self->valid($name); my $value = $self->get_nested_hash_value( $self->_processed_params, $name ); return [] if !defined $value; return ref $value eq 'ARRAY' ? $value : [$value]; } sub param_list { my ( $self, $name ) = @_; croak 'name parameter required' if @_ != 2; # guaranteed to always return an arrayref return if !$self->valid($name); my $value = $self->get_nested_hash_value( $self->_processed_params, $name ); return if !defined $value; return ref $value eq 'ARRAY' ? @$value : $value; } sub valid { my $self = shift; return if !$self->submitted; my @valid = @{ $self->_valid_names }; if (@_) { my $name = shift; return 1 if any { $name eq $_ } @valid; # not found - see if it's the name of a nested block my $parent; if ( defined $self->nested_name && $self->nested_name eq $name ) { $parent = $self; } else { ($parent) = first { $_->isa('HTML::FormFu::Element::Block') } @{ $self->get_all_elements( { nested_name => $name, } ) }; } if ( defined $parent ) { my $fail = any {defined} map { @{ $_->get_errors } } @{ $parent->get_fields }; return 1 if !$fail; } return; } # return a list of valid names, if no $name arg return @valid; } sub has_errors { my $self = shift; return if !$self->submitted; my @names = map { $_->nested_name } grep { @{ $_->get_errors } } grep { defined $_->nested_name } @{ $self->get_fields }; if (@_) { my $name = shift; return 1 if any {/\Q$name/} @names; return; } # return list of names with errors, if no $name arg return @names; } sub add_valid { my ( $self, $key, $value ) = @_; croak 'add_valid requires arguments ($key, $value)' if @_ != 3; $self->set_nested_hash_value( $self->input, $key, $value ); $self->set_nested_hash_value( $self->_processed_params, $key, $value ); if ( none { $_ eq $key } @{ $self->_valid_names } ) { push @{ $self->_valid_names }, $key; } return $value; } sub _single_plugin { my ( $self, $arg_ref ) = @_; if ( !ref $arg_ref ) { $arg_ref = { type => $arg_ref }; } elsif ( ref $arg_ref eq 'HASH' ) { # shallow clone $arg_ref = {%$arg_ref}; } else { croak 'invalid args'; } my $type = delete $arg_ref->{type}; my @return; my @names = map { ref $_ ? @$_ : $_ } grep {defined} ( delete $arg_ref->{name}, delete $arg_ref->{names} ); if (@names) { # add plugins to appropriate fields for my $x (@names) { for my $field ( @{ $self->get_fields( { nested_name => $x } ) } ) { my $new = $field->_require_plugin( $type, $arg_ref ); push @{ $field->_plugins }, $new; push @return, $new; } } } else { # add plugin directly to form my $new = $self->_require_plugin( $type, $arg_ref ); push @{ $self->_plugins }, $new; push @return, $new; } return @return; } around render => sub { my $orig = shift; my $self = shift; my $plugins = $self->get_plugins; for my $plugin (@$plugins) { $plugin->render; } my $output = $self->$orig; for my $plugin (@$plugins) { $plugin->post_render( \$output ); } return $output; }; sub render_data { my ( $self, $args ) = @_; my $render = $self->render_data_non_recursive( { elements => [ map { $_->render_data } @{ $self->_elements } ], $args ? %$args : (), } ); return $render; } sub render_data_non_recursive { my ( $self, $args ) = @_; my %render = ( filename => $self->filename, javascript => $self->javascript, javascript_src => $self->javascript_src, attributes => xml_escape( $self->attributes ), stash => $self->stash, $args ? %$args : (), ); $render{form} = \%render; weaken( $render{form} ); $render{object} = $self; if ($self->force_error_message || ( $self->has_errors && defined $self->form_error_message ) ) { $render{form_error_message} = xml_escape( $self->form_error_message ); $render{form_error_message_class} = $self->form_error_message_class; } return \%render; } sub string { my ( $self, $args_ref ) = @_; $args_ref ||= {}; my $html = $self->_string_form_start( $args_ref ); # form template $html .= "\n"; for my $element ( @{ $self->get_elements } ) { # call render, so that child elements can use a different renderer my $element_html = $element->render; # skip Blank fields if ( length $element_html ) { $html .= $element_html . "\n"; } } $html .= $self->_string_form_end( $args_ref ); $html .= "\n"; return $html; } sub _string_form_start { my ( $self, $args_ref ) = @_; # start_form template my $render_ref = exists $args_ref->{render_data} ? $args_ref->{render_data} : $self->render_data_non_recursive; my $html = sprintf "", process_attrs( $render_ref->{attributes} ); if ( defined $render_ref->{form_error_message} ) { $html .= sprintf qq{\n
%s
}, $render_ref->{form_error_message_class}, $render_ref->{form_error_message}, ; } if ( defined $render_ref->{javascript_src} ) { my $uri = $render_ref->{javascript_src}; my @uris = ref $uri eq 'ARRAY' ? @$uri : ($uri); for my $uri (@uris) { $html .= sprintf qq{\n}, $uri, ; } } if ( defined $render_ref->{javascript} ) { $html .= sprintf qq{\n}, $render_ref->{javascript}, ; } return $html; } sub _string_form_end { my ( $self ) = @_; # end_form template return ""; } sub start { my $self = shift; if ( 'tt' eq $self->render_method ) { return $self->tt( { filename => 'start_form', render_data => $self->render_data_non_recursive, } ); } else { return $self->_string_form_start( @_ ); } } sub end { my $self = shift; if ( 'tt' eq $self->render_method ) { return $self->tt( { filename => 'end_form', render_data => $self->render_data_non_recursive, } ); } else { return $self->_string_form_end( @_ ); } } sub hidden_fields { my ($self) = @_; return join $EMPTY_STR, map { $_->render } @{ $self->get_fields( { type => 'Hidden' } ) }; } sub output_processor { my ( $self, $arg ) = @_; my @return; if ( ref $arg eq 'ARRAY' ) { push @return, map { $self->_single_output_processor($_) } @$arg; } else { push @return, $self->_single_output_processor($arg); } return @return == 1 ? $return[0] : @return; } sub _single_output_processor { my ( $self, $arg ) = @_; if ( !ref $arg ) { $arg = { type => $arg }; } elsif ( ref $arg eq 'HASH' ) { $arg = Clone::clone($arg); } else { croak 'invalid args'; } my $type = delete $arg->{type}; my $new = $self->_require_output_processor( $type, $arg ); push @{ $self->_output_processors }, $new; return $new; } sub _require_output_processor { my ( $self, $type, $opt ) = @_; croak 'required arguments: $self, $type, \%options' if @_ != 3; croak "options argument must be hash-ref" if reftype($opt) ne 'HASH'; my $class = $type; if ( not $class =~ s/^\+// ) { $class = "HTML::FormFu::OutputProcessor::$class"; } $type =~ s/^\+//; require_class($class); my $object = $class->new( { type => $type, parent => $self, } ); # handle default_args my $parent = $self->parent; if ( $parent && exists $parent->default_args->{output_processor}{$type} ) { %$opt = ( %{ $parent->default_args->{output_processer}{$type} }, %$opt ); } $object->populate($opt); return $object; } sub get_output_processors { my $self = shift; my %args = _parse_args(@_); my @x = @{ $self->_output_processors }; if ( exists $args{type} ) { @x = grep { $_->type eq $args{type} } @x; } return \@x; } sub get_output_processor { my $self = shift; my $x = $self->get_output_processors(@_); return @$x ? $x->[0] : (); } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu - HTML Form Creation, Rendering and Validation Framework =head1 SYNOPSIS Note: These examples make use of L. As of C v02.005, the L module is not bundled with C and is available in a stand-alone distribution. use HTML::FormFu; my $form = HTML::FormFu->new; $form->load_config_file('form.yml'); $form->process( $cgi_query ); if ( $form->submitted_and_valid ) { # do something with $form->params } else { # display the form $template->param( form => $form ); } If you're using L, a more suitable example might be: package MyApp::Controller::User; use strict; use base 'Catalyst::Controller::HTML::FormFu'; sub user : Chained CaptureArgs(1) { my ( $self, $c, $id ) = @_; my $rs = $c->model('Schema')->resultset('User'); $c->stash->{user} = $rs->find( $id ); return; } sub edit : Chained('user') Args(0) FormConfig { my ( $self, $c ) = @_; my $form = $c->stash->{form}; my $user = $c->stash->{user}; if ( $form->submitted_and_valid ) { $form->model->update( $user ); $c->res->redirect( $c->uri_for( "/user/$id" ) ); return; } $form->model->default_values( $user ) if ! $form->submitted; } Note: Because L is automatically called for you by the Catalyst controller; if you make any modifications to the form within your action method, such as adding or changing elements, adding constraints, etc; you must call L again yourself before using L, any of the methods listed under L or L, or rendering the form. Here's an example of a config file to create a basic login form (all examples here are L, but you can use any format supported by L), you can also create forms directly in your perl code, rather than using an external config file. --- action: /login indicator: submit auto_fieldset: 1 elements: - type: Text name: user constraints: - Required - type: Password name: pass constraints: - Required - type: Submit name: submit constraints: - SingleValue =head1 DESCRIPTION L is a HTML form framework which aims to be as easy as possible to use for basic web forms, but with the power and flexibility to do anything else you might want to do (as long as it involves forms). You can configure almost any part of formfu's behaviour and output. By default formfu renders "XHTML 1.0 Strict" compliant markup, with as little extra markup as possible, but with sufficient CSS class names to allow for a wide-range of output styles to be generated by changing only the CSS. All methods listed below (except L) can either be called as a normal method on your C<$form> object, or as an option in your config file. Examples will mainly be shown in L config syntax. This documentation follows the convention that method arguments surrounded by square brackets C<[]> are I, and all other arguments are required. =head1 BUILDING A FORM =head2 new Arguments: [\%options] Return Value: $form Create a new L object. Any method which can be called on the L object may instead be passed as an argument to L. my $form = HTML::FormFu->new({ action => '/search', method => 'GET', auto_fieldset => 1, }); =head2 load_config_file Arguments: $filename Arguments: \@filenames Return Value: $form Accepts a filename or list of file names, whose filetypes should be of any format recognized by L. The content of each config file is passed to L, and so are added to the form. L may be called in a config file itself, so as to allow common settings to be kept in a single config file which may be loaded by any form. --- load_config_file: - file1 - file2 YAML multiple documents within a single file. The document start marker is a line containing 3 dashes. Multiple documents will be applied in order, just as if multiple filenames had been given. In the following example, multiple documents are taken advantage of to load another config file after the elements are added. (If this were a single document, the C would be called before C, regardless of its position in the file). --- elements: - name: one - name: two --- load_config_file: ext.yml Relative paths are resolved from the L directory if it is set, otherwise from the current working directory. See L for advice on organising config files. =head2 config_callback Arguments: \%options If defined, the arguments are used to create a L object during L which may be used to pre-process the config before it is sent to L. For example, the code below adds a callback to a form that will dynamically alter any config value ending in ".yml" to end in ".yaml" when you call L: $form->config_callback({ plain_value => sub { my( $visitor, $data ) = @_; s/\.yml/.yaml/; } }); Default Value: not defined This method is a special 'inherited accessor', which means it can be set on the form, a block element or a single element. When the value is read, if no value is defined it automatically traverses the element's hierarchy of parents, through any block elements and up to the form, searching for a defined value. =head2 populate Arguments: \%options Return Value: $form Each option key/value passed may be any L method-name and arguments. Provides a simple way to set multiple values, or add multiple elements to a form with a single method-call. Attempts to call the method-names in a semi-intelligent order (see the source of populate() in C for details). =head2 default_values Arguments: \%defaults Return Value: $form Set multiple field's default values from a single hash-ref. The hash-ref's keys correspond to a form field's name, and the value is passed to the field's L. This should be called after all fields have been added to the form, and before L is called (otherwise, call L again before rendering the form). =head2 config_file_path Arguments: $directory_name L defines where configuration files will be searched for, if an absolute path is not given to L. Default Value: not defined This method is a special 'inherited accessor', which means it can be set on the form, a block element or a single element. When the value is read, if no value is defined it automatically traverses the element's hierarchy of parents, through any block elements and up to the form, searching for a defined value. Is an L. =head2 indicator Arguments: $field_name Arguments: \&coderef If L is set to a fieldname, L will return true if a value for that fieldname was submitted. If L is set to a code-ref, it will be called as a subroutine with the two arguments C<$form> and C<$query>, and its return value will be used as the return value for L. If L is not set, L will return true if a value for any known fieldname was submitted. =head2 auto_fieldset Arguments: 1 Arguments: \%options Return Value: $fieldset This setting is suitable for most basic forms, and means you can generally ignore adding fieldsets yourself. Calling C<< $form->auto_fieldset(1) >> immediately adds a fieldset element to the form. Thereafter, C<< $form->elements() >> will add all elements (except fieldsets) to that fieldset, rather than directly to the form. To be specific, the elements are added to the I fieldset on the form, so if you add another fieldset, any further elements will be added to that fieldset. Also, you may pass a hashref to auto_fieldset(), and this will be used to set defaults for the first fieldset created. A few examples and their output, to demonstrate: 2 elements with no fieldset. --- elements: - type: Text name: foo - type: Text name: bar
2 elements with an L. --- auto_fieldset: 1 elements: - type: Text name: foo - type: Text name: bar
The 3rd element is within a new fieldset --- auto_fieldset: { id: fs } elements: - type: Text name: foo - type: Text name: bar - type: Fieldset - type: Text name: baz
Because of this behaviour, if you want nested fieldsets you will have to add each nested fieldset directly to its intended parent. my $parent = $form->get_element({ type => 'Fieldset' }); $parent->element('fieldset'); =head2 form_error_message Arguments: $string Normally, input errors cause an error message to be displayed alongside the appropriate form field. If you'd also like a general error message to be displayed at the top of the form, you can set the message with L. To set the CSS class for the message, see L. To change the markup used to display the message, edit the C template file. See L. Is an L. =head2 force_error_message If true, forces the L to be displayed even if there are no field errors. =head2 default_args Arguments: \%defaults Set defaults which will be added to every element, constraint, etc. of the given type which is subsequently added to the form. For example, to make every C element automatically have a size of C<10>, and make every C deflator automatically get its strftime set to C<%d/%m/%Y>: default_args: elements: Text: size: 10 deflators: Strftime: strftime: '%d/%m/%Y' An example to make all DateTime elements automatically get an appropriate Strftime deflator and a DateTime inflator: default_args: elements: DateTime: deflators: type: Strftime strftime: '%d-%m-%Y' inflators: type: DateTime parser: strptime: '%d-%m-%Y' =head3 Pseudo types As a special case, you can also use the C keys C, C and C to match any element which inherits from L or which C L or L. =head3 Alternatives Each C key can contain an C list using the C<|> divider: e.g. # apply the given class to any Element of type Password or Button default_args: elements: 'Password|Button': attrs: class: novalidate =head3 Match ancestor Each C key list can contain a type starting with C<+> to only match elements with an ancestor of the given type: e.g. # only apple the given class to an Input field within a Multi block default_args: elements: 'Input|+Multi': attrs: class: novalidate =head3 Don't match ancestor Each C key list can contain a type starting with C<-> to only match elements who do not have an ancestor of the given type: e.g. # apply the given class only to Input fields that are not in a Multi block default_args: elements: 'Input|-Multi': attrs: clasS: validate =head3 Order The arguments are applied in least- to most-specific order: C, C, C, C<$type>. Within each of these, arguments are applied in order of shortest-first to longest-last. The C key must match the value returned by C, e.g. L. If, for example, you have a custom element outside of the C namespace, which you load via C<< $form->element({ type => '+My::Custom::Element' }) >>, the key given to L should B include the leading C<+>, as that is stripped-out of the returned C value. Example: # don't include the leading '+' here default_args: elements: 'My::Custom::Element': attrs: class: whatever # do include the leading '+' here elements: - type: +My::Custom::Element =head3 Clashes L generates a single hashref to pass to L, merging arguments for each type in turn - meaning L is only called once in total - not once for each type. Because scalar values are B merged - this means later values will override earlier values: e.g. # Normally, calling $field->add_attrs({ class => 'input' }) # then calling $field->add_attrs({ class => 'not-in-multi' }) # would result in both values being retained: # class="input not-in-multi" # # However, default_args() creates a single data-structure to pass once # to populate(), so any scalar values will overwrite earlier ones # before they reach populate(). # # The below example would result in the longest-matching key # overwriting any others: # class="not-in-multi" # default_args: elements: Input: add_attrs: class: input 'Input:-Multi': add_attrs: class: not-in-multi =head3 Strictness Note: Unlike the proper methods which have aliases, for example L which is an alias for L - the keys given to C must be of the plural form, e.g.: default_args: elements: {} deflators: {} filters: {} constraints: {} inflators: {} validators: {} transformers: {} output_processors: {} =head2 javascript If set, the contents will be rendered within a C
EOF is( "$form", $xhtml ); param_list.t100644000764000764 70212253555153 21665 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/formuse strict; use warnings; use Test::More tests => 3; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->element('Text')->name('baz'); $form->process( { foo => 'a', bar => [ 'b', 'c' ], } ); is_deeply( [ $form->param_list('foo') ], ['a'] ); is_deeply( [ $form->param_list('bar') ], [ 'b', 'c' ] ); is_deeply( [ $form->param_list('baz') ], [] ); inflators000755000764000764 012253555153 20264 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregatearray.t100644000764000764 110612253555153 21725 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/inflatorsuse strict; use warnings; use Test::More tests => 8; use HTML::FormFu; my $form = HTML::FormFu->new; my $field = $form->element('Text')->name('foo'); $field->inflator('DateTime')->parser( { strptime => '%d/%m/%Y' } ); $form->process( { foo => [ '31/12/2006', '01/01/2007' ], } ); my $value = $form->param_array('foo'); isa_ok( $value->[0], 'DateTime' ); is( $value->[0]->day, 31 ); is( $value->[0]->month, 12 ); is( $value->[0]->year, 2006 ); isa_ok( $value->[1], 'DateTime' ); is( $value->[1]->day, 1 ); is( $value->[1]->month, 1 ); is( $value->[1]->year, 2007 ); index.tt100644000764000764 23112253555153 22117 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/examples/unicode/root [% form %] Transformer.pm100644000764000764 315712253555153 21612 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFupackage HTML::FormFu::Transformer; { $HTML::FormFu::Transformer::VERSION = '1.00'; } use Moose; extends 'HTML::FormFu::Processor'; use HTML::FormFu::Exception::Transformer; use Scalar::Util qw( blessed ); use Carp qw( croak ); sub process { my ( $self, $values, $params ) = @_; my $return; my @errors; if ( ref $values eq 'ARRAY' ) { my @return; for my $value (@$values) { my ($return) = eval { $self->transformer( $value, $params ) }; if ($@) { push @errors, $self->return_error($@); push @return, undef; } else { push @return, $return; } } $return = \@return; } else { ($return) = eval { $self->transformer( $values, $params ) }; if ($@) { push @errors, $self->return_error($@); } } $self->set_nested_hash_value( $params, $self->nested_name, $return ); return (@errors); } sub return_error { my ( $self, $err ) = @_; if ( !blessed $err || !$err->isa('HTML::FormFu::Exception::Transformer') ) { $err = HTML::FormFu::Exception::Transformer->new; } return $err; } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Transformer - Transformer Base Class =head1 SYNOPSIS =head1 DESCRIPTION =head1 METHODS =head1 CORE TRANSFORMERS =over =item L =back =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut UploadParam.pm100644000764000764 367612253555153 21523 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFupackage HTML::FormFu::UploadParam; { $HTML::FormFu::UploadParam::VERSION = '1.00'; } use Moose; use MooseX::Attribute::Chained; use Carp qw( croak ); use File::Temp qw( tempfile ); use Scalar::Util qw( reftype blessed weaken ); use Storable qw( nfreeze thaw ); has param => ( is => 'rw', traits => ['Chained'], required => 1 ); has filename => ( is => 'rw', traits => ['Chained'] ); sub form { my $self = shift; if (@_) { $self->{form} = shift; weaken( $self->{form} ); } return $self->{form}; } sub STORABLE_freeze { my ( $self, $cloning ) = @_; return if $cloning; my $fh = $self->{param}->can('fh') ? $self->{param}->fh : $self->{param}; seek $fh, 0, 0; local $/ = undef; my $data = <$fh>; if ( defined( my $dir = $self->form->tmp_upload_dir ) ) { my ( $fh, $filename ) = tempfile( DIR => $dir, UNLINK => 0 ); print $fh $data; close $fh; return nfreeze( { filename => $filename } ); } else { return nfreeze( { param => $data } ); } } sub STORABLE_thaw { my ( $self, $cloning, $serialized ) = @_; return if $cloning; my $data = thaw($serialized); my $filename = $data->{filename}; if ($filename) { open my $fh, '<', $filename or croak "could not open file in tmp dir: '$filename'"; $self->{param} = $fh; $self->{filename} = $filename; } else { my ($fh) = tempfile(); print $fh $data->{param}; seek $fh, 0, 0; $self->{param} = $fh; } return; } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::UploadParam - accessor class =head1 DESCRIPTION =head1 SEE ALSO L, L =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Src.pm100644000764000764 140712253555153 21424 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Elementpackage HTML::FormFu::Element::Src; { $HTML::FormFu::Element::Src::VERSION = '1.00'; } use Moose; extends 'HTML::FormFu::Element::Block'; after BUILD => sub { my $self = shift; $self->tag(undef); return; }; __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Element::Src - custom HTML element =head1 DESCRIPTION Allows you to add markup directly into the form, without surrounding C<<
>> tags. =head1 SEE ALSO Is a sub-class of, and inherits methods from L, L L =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut URL.pm100644000764000764 607512253555153 21345 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Elementpackage HTML::FormFu::Element::URL; { $HTML::FormFu::Element::URL::VERSION = '1.00'; } use Moose; extends 'HTML::FormFu::Element'; with 'HTML::FormFu::Role::Element::Input'; use HTML::FormFu::Attribute qw( mk_output_accessors ); has http_only => ( is => 'rw', traits => ['Chained'] ); has https_only => ( is => 'rw', traits => ['Chained'] ); has error_message => ( is => 'rw', predicate => 'has_message', traits => ['Chained'], ); has _has_auto_regex_constraint => ( is => 'rw', init_arg => undef, ); __PACKAGE__->mk_output_accessors(qw( message )); after BUILD => sub { my $self = shift; $self->field_type('url'); return; }; sub pre_process { my ( $self ) = @_; my $constraint; if ( $self->_has_auto_regex_constraint ) { $constraint = $self->_has_auto_regex_constraint; } else { my $scheme; if ( $self->http_only ) { $scheme = 'http'; } elsif ( $self->https_only ) { $scheme = 'https'; } else { $scheme = 'https?'; } $constraint = $self->constraint({ type => 'Regex', common => [ 'URI', 'HTTP', { -scheme => $scheme }, ], }); $self->_has_auto_regex_constraint( $constraint ); # 'pattern' attribute $self->pattern( "$scheme://.*" ); } my $message = $self->error_message; if ( defined $message && length $message ) { $constraint->message( $message ); } return; }; __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Element::URL - HTML5 URL form field =head1 SYNOPSIS my $element = $form->element( URL => 'foo' ); # no need to add a separate constraint =head1 DESCRIPTION HTML5 URL form field which provides native client-side validation in modern browsers. Creates an input field with C<>. Also sets the C attribute to restrict the client-side validation to only our desired schemes (http and/or https). This element automatically adds a L, so you don't have to. If neither L or L are set, the constraint allows any HTTP or HTTPS url. =head1 METHODS =head2 http_only =head2 https_only =head2 message Arguments: $string Set the error message on the L which is automatically added. =head2 message_xml Arguments: $string If you don't want your error message to be XML-escaped, use the L method instead of L. =head2 message_loc Arguments: $localization_key Set the error message using a L10N key. =head1 SEE ALSO Is a sub-class of, and inherits methods from L, L, L. L =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Role000755000764000764 012253555153 17505 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFuRender.pm100644000764000764 616312253555153 21430 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Rolepackage HTML::FormFu::Role::Render; { $HTML::FormFu::Role::Render::VERSION = '1.00'; } use HTML::FormFu::Util qw( process_attrs ); use Carp qw( croak ); use Moose::Role; our $SHARE_DIR; our $SHARE_ERROR; sub render { my $self = shift; my $render_method = $ENV{HTML_FORMFU_RENDER_METHOD} || $self->render_method; my $output = $self->$render_method(@_); for my $proc ( @{ $self->form->get_output_processors } ) { $output = $proc->process($output); } return $output; } sub tt { my ( $self, $args ) = @_; $args ||= {}; $args->{filename} = $self->filename if !exists $args->{filename}; $args->{render_data} = $self->render_data if !exists $args->{render_data}; my $form = $self->form; my $share_dir = _share_dir(); my %args = %{ $self->tt_args }; if ( defined $share_dir ) { # add $share_dir to the end of INCLUDE_PATH $args{INCLUDE_PATH} = exists $args{INCLUDE_PATH} ? ref $args{INCLUDE_PATH} eq 'ARRAY' ? [ @{ $args{INCLUDE_PATH} }, $share_dir ] : [ $args{INCLUDE_PATH}, $share_dir ] : [$share_dir]; } $args{ENCODING} = 'UTF-8' if !exists $args{ENCODING}; $args{RELATIVE} = 1; $args{RECURSION} = 1; my $tt_module = $form->tt_module; $tt_module = $ENV{HTML_FORMFU_TT_MODULE} if defined $ENV{HTML_FORMFU_TT_MODULE} && length $ENV{HTML_FORMFU_TT_MODULE}; my $class = $tt_module; $class =~ s|::|/|g; $class .= ".pm"; if ( !exists $::INC{$class} ) { eval { require $class }; croak $@ if $@; } my $template = $tt_module->new( \%args ); my $output; my %vars = ( self => $args->{render_data}, process_attrs => \&process_attrs, ); if ( !$template->process( $args->{filename}, \%vars, \$output ) ) { my $error = $template->error; if ( $error->type() eq 'file' && $error =~ /not found/i ) { croak <tt_args->{INCLUDE_PATH} to point to the template directory. ERROR_MESSAGE } else { croak $error; } } return $output; } sub _share_dir { return $SHARE_DIR if defined $SHARE_DIR; return if $SHARE_ERROR; eval { require 'File/ShareDir.pm'; require 'File/Spec.pm'; # dist_dir() doesn't reliably return the directory our files are in. # find the path of one of our files, then get the directory from that my $path = File::ShareDir::dist_file( 'HTML-FormFu', 'templates/tt/xhtml/form' ); my ( $volume, $dirs, $file ) = File::Spec->splitpath($path); $SHARE_DIR = File::Spec->catpath( $volume, $dirs, '' ); }; if ($@) { $SHARE_DIR = undef; $SHARE_ERROR = 1; return; } return $SHARE_DIR; } 1; block100644000764000764 32112253555153 22110 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/share/templates/tt/xhtml[% INCLUDE start_block %] [% IF self.content.defined %][% self.content %] [% ELSE %][% FOREACH element = self.elements %][% INCLUDE $element.filename self = element %] [% END %][% END %][% INCLUDE end_block %]field100644000764000764 152412253555153 22127 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/share/templates/tt/xhtml[% IF self.container_tag.defined %]<[% self.container_tag %][% process_attrs(self.container_attributes) %]>[% END %][% IF self.label.defined && self.label_tag == 'legend' %] [% INCLUDE $self.label_filename %][% END %][% INCLUDE $self.errors_filename %][% IF self.label.defined && self.label_tag != 'legend' && !self.reverse_single %] [% INCLUDE $self.label_filename %][% END %][% IF self.container_tag.defined %] [% END %][% content %][% IF self.label.defined && self.label_tag != 'legend' && self.reverse_single %] [% INCLUDE $self.label_filename %][% END %][% IF self.comment.defined %] [% self.comment %] [% END %][% IF self.container_tag.defined %] [% END %][% IF self.javascript.defined %] [% END %]input100644000764000764 7612253555153 22144 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/share/templates/tt/xhtml[% WRAPPER field %][% INCLUDE $self.field_filename %][% END %]label100644000764000764 14712253555153 22103 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/share/templates/tt/xhtml<[% self.label_tag %][% process_attrs(self.label_attributes) %]>[% self.label %]multi100644000764000764 71612253555153 22160 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/share/templates/tt/xhtml[% WRAPPER field %] [% FOREACH element = self.elements %][% IF element.reverse_multi %][% INCLUDE $element.field_filename self = element %][% IF element.label.defined %] [% INCLUDE $element.label_filename self = element %][% END %][% ELSE %][% IF element.label.defined %][% INCLUDE $element.label_filename self = element %] [% END %][% INCLUDE $element.field_filename self = element %][% END %] [% END %][% END %]MyDeflator.pm100644000764000764 32112253555153 21510 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t/lib/HTMLFormFupackage HTMLFormFu::MyDeflator; use strict; use warnings; use base 'HTML::FormFu::Deflator'; sub deflator { my ( $self, $value ) = @_; return if !defined $value; return $value->{value}; } 1; MyFormRole.pm100644000764000764 23312253555153 21477 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t/lib/HTMLFormFupackage HTMLFormFu::MyFormRole; use Moose::Role; sub custom_role_method { my ( $self ) = @_; return sprintf "form ID: %s", $self->id; } 1; yaml_utf8.txt100644000764000764 312253555153 21745 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/bugsfüyaml_utf8.yml100644000764000764 5312253555153 21754 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/bugs--- elements: - name: foo label: fü bool.t100644000764000764 111312253555153 22106 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 4; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->constraint('Bool'); # Valid { $form->process( { foo => 1, bar => 0, } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); } # Invalid { $form->process( { foo => '01', bar => 'a', } ); ok( !$form->valid('foo'), 'foo not valid' ); ok( !$form->valid('bar'), 'bar not valid' ); } file.t100644000764000764 375412253555153 22107 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More; use HTML::FormFu; eval "use CGI"; if ($@) { plan skip_all => 'CGI required'; die $!; } plan tests => 10; # Copied from CGI.pm - http://search.cpan.org/perldoc?CGI %ENV = ( %ENV, 'SCRIPT_NAME' => '/test.cgi', 'SERVER_NAME' => 'perl.org', 'HTTP_CONNECTION' => 'TE, close', 'REQUEST_METHOD' => 'POST', 'SCRIPT_URI' => 'http://www.perl.org/test.cgi', 'SCRIPT_FILENAME' => '/home/usr/test.cgi', 'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) ', 'HTTP_TE' => 'deflate,gzip;q=0.3', 'QUERY_STRING' => '', 'REMOTE_PORT' => '1855', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '127.0.0.1', 'CONTENT_TYPE' => 'multipart/form-data; boundary=xYzZY', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'PATH' => '/usr/local/bin:/usr/bin:/bin', 'REQUEST_URI' => '/test.cgi', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SCRIPT_URL' => '/test.cgi', 'SERVER_ADDR' => '127.0.0.1', 'DOCUMENT_ROOT' => '/home/develop', 'HTTP_HOST' => 'www.perl.org' ); my $q; { my $file = 't-aggregate/elements/file_post.txt'; local *STDIN; open STDIN, "<", $file or die "missing test file $file"; binmode STDIN; $q = CGI->new; } my $form = HTML::FormFu->new; $form->load_config_file('t-aggregate/constraints/file.yml'); $form->process($q); { ok( $form->submitted ); ok( !$form->has_errors('hello_world') ); ok( !$form->has_errors('does_not_exist_gif') ); ok( $form->valid('hello_world') ); ok( $form->valid('does_not_exist_gif') ); } $form->process( { hello_world => 'not a file', } ); { ok( $form->submitted ); ok( $form->has_errors('hello_world') ); ok( !$form->has_errors('does_not_exist_gif') ); ok( !$form->valid('hello_world') ); ok( !$form->valid('does_not_exist_gif') ); } word.t100644000764000764 252212253555153 22133 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 16; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->constraint('Word'); # Valid { $form->process( { foo => 'aaa', bar => 'bbbbbbb', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( grep { $_ eq 'foo' } $form->valid ); ok( grep { $_ eq 'bar' } $form->valid ); } # [space] - Invalid { $form->process( { foo => 'a', bar => 'b c', } ); ok( $form->valid('foo'), 'foo valid' ); ok( !$form->valid('bar'), 'foo valid' ); ok( grep { $_ eq 'foo' } $form->valid ); ok( !grep { $_ eq 'bar' } $form->valid ); } # [newline] - Invalid { $form->process( { foo => 'a', bar => "b\nc", } ); ok( $form->valid('foo'), 'foo valid' ); ok( !$form->valid('bar'), 'foo valid' ); ok( grep { $_ eq 'foo' } $form->valid ); ok( !grep { $_ eq 'bar' } $form->valid ); } # "0" is valid { $form->process( { foo => 0, bar => 2, } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'foo valid' ); ok( grep { $_ eq 'foo' } $form->valid ); ok( grep { $_ eq 'bar' } $form->valid ); } label.yml100644000764000764 27712253555153 22027 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/elements--- elements: - type: Label name: foo - type: Label name: foo3 default: bar retain_default: 1 tag: div - type: Submit name: submit reverse.t100644000764000764 314112253555153 22076 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/elementsuse strict; use warnings; use Test::More tests => 4; use HTML::FormFu; my $form = HTML::FormFu->new( { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } ); # add element to test reverse_single reversing labels my $field1 = $form->element('Text')->name('foo1')->label('My Foo 1') ->reverse_single(1); # add element to test reverse_multi reversing labels in multi my $multi1 = $form->element('Multi')->label('My Multi 1'); $multi1->element('Text')->name('bar1')->label('My Bar 1')->reverse_multi(1); # add element to test reverse_multi not reversing labels outside multi my $field2 = $form->element('Text')->name('foo2')->label('My Foo 2')->reverse_multi(1); # add element to test reverse_single not reversing labels in multi my $multi2 = $form->element('Multi')->label('My Multi 2'); $multi2->element('Text')->name('bar2')->label('My Bar 2')->reverse_single(1); my $field1_xhtml = qq{
}; is( "$field1", $field1_xhtml, 'reverse_single normal' ); my $multi1_xhtml = qq{
}; is( "$multi1", $multi1_xhtml, 'reverse_multi normal' ); my $field2_xhtml = qq{
}; is( "$field2", $field2_xhtml, 'reverse_multi outside multi' ); my $multi2_xhtml = qq{
}; is( "$multi1", $multi1_xhtml, 'reverse_single inside multi' ); callback.t100644000764000764 240712253555153 22017 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/filtersuse strict; use warnings; use Test::More tests => 6; use HTML::FormFu; use lib 'lib'; my $form = HTML::FormFu->new; $form->element('Text')->name('foo')->filter('Callback') ->callback( sub { $_[0] =~ s/(\d)(\d)/$2$1/g; shift; } ); $form->element('Text')->name('bar')->filter('Callback'); $form->element('Text')->name('baz')->filter('Callback') ->callback('FilterCallback::my_filter'); my $original_foo = "ab123456"; my $filtered_foo = "ab214365"; my $original_bar = "ab123456"; my $filtered_bar = "ab123456"; my $original_baz = "abcdef"; my $filtered_baz = "ABCdef"; $form->process( { foo => $original_foo, bar => $original_bar, baz => $original_baz, } ); # foo is quoted is( $form->param('foo'), $filtered_foo, 'foo filtered' ); is( $form->params->{foo}, $filtered_foo, 'foo filtered' ); # bar is filtered is( $form->param('bar'), $filtered_bar, 'bar filtered' ); is( $form->params->{bar}, $filtered_bar, 'bar filtered' ); # baz is filtered is( $form->param('baz'), $filtered_baz, 'baz filtered' ); is( $form->params->{baz}, $filtered_baz, 'baz filtered' ); { package FilterCallback; use strict; use warnings; sub my_filter { my ($value) = @_; $value =~ tr/abc/ABC/; return $value; } } get_element.t100644000764000764 171612253555153 22050 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/formuse strict; use warnings; use Test::More tests => 12; use HTML::FormFu; my $form = HTML::FormFu->new; my $fs = $form->element('Fieldset'); my $e1 = $fs->element('Text')->name('foo'); my $e2 = $fs->element('Hidden')->name('foo'); my $e3 = $fs->element('Hidden')->name('bar'); { my @elems = $form->get_element; is( @elems, 1 ); ok( $elems[0] == $fs ); } { my @elems = $form->get_element( { type => 'Fieldset' } ); is( @elems, 1 ); ok( $elems[0] == $fs ); } { my @elems = $fs->get_element('foo'); is( @elems, 1 ); ok( $elems[0] == $e1 ); } { my @elems = $fs->get_element( { name => 'foo' } ); is( @elems, 1 ); ok( $elems[0] == $e1 ); } { my @elems = $fs->get_element( { type => 'Hidden' } ); is( @elems, 1 ); ok( $elems[0] == $e2 ); } { my @elems = $fs->get_element( { name => 'foo', type => 'Hidden', } ); is( @elems, 1 ); ok( $elems[0] == $e2 ); } get_filters.t100644000764000764 247612253555153 22073 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/formuse strict; use warnings; use Test::More tests => 20; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('name')->filter('LowerCase'); $form->element('Text')->name('age'); $form->filter( HTMLEscape => 'name', 'age' ); $form->filter('Whitespace'); { my $filters = $form->get_filters; is( @$filters, 5, '5 filters' ); is( $filters->[0]->name, 'name' ); is( $filters->[1]->name, 'name' ); is( $filters->[2]->name, 'name' ); is( $filters->[3]->name, 'age' ); is( $filters->[4]->name, 'age' ); is( $filters->[0]->type, 'LowerCase' ); is( $filters->[1]->type, 'HTMLEscape' ); is( $filters->[2]->type, 'Whitespace' ); is( $filters->[3]->type, 'HTMLEscape' ); is( $filters->[4]->type, 'Whitespace' ); } { my $filters = $form->get_filters('name'); is( @$filters, 3, '3 filters' ); is( $filters->[0]->type, 'LowerCase' ); is( $filters->[1]->type, 'HTMLEscape' ); is( $filters->[2]->type, 'Whitespace' ); } { my $filters = $form->get_filters( { name => 'age' } ); is( @$filters, 2, '2 filters' ); is( $filters->[0]->type, 'HTMLEscape' ); is( $filters->[1]->type, 'Whitespace' ); } { my $filters = $form->get_filters( { type => 'LowerCase' } ); is( @$filters, 1, '1 filter' ); is( $filters->[0]->name, 'name' ); } languages.yml100644000764000764 12512253555153 22035 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/formlanguages: - de elements: - name: foo - name: bar constraints: - Required param_array.t100644000764000764 67112253555153 22035 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/formuse strict; use warnings; use Test::More tests => 3; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->element('Text')->name('baz'); $form->process( { foo => 'a', bar => [ 'b', 'c' ], } ); is_deeply( $form->param_array('foo'), ['a'] ); is_deeply( $form->param_array('bar'), [ 'b', 'c' ] ); is_deeply( $form->param_array('baz'), [] ); param_value.t100644000764000764 74412253555153 22034 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/formuse strict; use warnings; use Test::More tests => 4; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->element('Text')->name('baz'); $form->process( { foo => 'a', bar => [ 'b', 'c' ], } ); is( $form->param_value('foo'), 'a' ); is( $form->param_value('bar'), 'b' ); my @baz = $form->param_value('baz'); # we got 1 value ok( @baz == 1 ); # it was undef is( $baz[0], undef ); repeatable000755000764000764 012253555153 20367 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregateclone.t100644000764000764 353112253555153 22016 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/repeatableuse strict; use warnings; use Scalar::Util qw/ refaddr /; use Test::More tests => 19; use HTML::FormFu; my $form = HTML::FormFu->new; $form->load_config_file('t-aggregate/repeatable/clone.yml'); $form->get_all_element( { type => 'Repeatable' } )->repeat(2); $form->process( { 'rep_1.foo' => 'a', 'rep_1.bar' => '', 'rep_2.foo' => '', 'rep_2.bar' => 'd', count => 2, } ); isa_ok( $form, 'HTML::FormFu' ); # fieldset my $fs = $form->get_element; isa_ok( $fs, 'HTML::FormFu::Element::Fieldset' ); is( refaddr( $fs->parent ), refaddr($form), ); # hidden field my $hidden = $form->get_field('count'); isa_ok( $hidden, 'HTML::FormFu::Element::Hidden' ); is( refaddr( $hidden->parent ), refaddr($fs), ); # repeatable my $rep = $fs->get_element( { type => 'Repeatable' } ); isa_ok( $rep, 'HTML::FormFu::Element::Repeatable' ); is( refaddr( $rep->parent ), refaddr($fs), ); # block 1 { my $block = $rep->get_elements->[0]; my $foo = $block->get_fields->[0]; is( refaddr( $foo->parent ), refaddr($block), ); is( refaddr( $foo->get_constraint->parent ), refaddr($foo), ); ok( !$foo->get_error ); my $bar = $block->get_fields->[1]; is( refaddr( $bar->parent ), refaddr($block), ); is( refaddr( $bar->get_constraint->parent ), refaddr($bar), ); is( refaddr( $bar->get_error->parent ), refaddr($bar), ); } # block 2 { my $block = $rep->get_elements->[1]; my $foo = $block->get_fields->[0]; is( refaddr( $foo->parent ), refaddr($block), ); is( refaddr( $foo->get_constraint->parent ), refaddr($foo), ); is( refaddr( $foo->get_error->parent ), refaddr($foo), ); my $bar = $block->get_fields->[1]; is( refaddr( $bar->parent ), refaddr($block), ); is( refaddr( $bar->get_constraint->parent ), refaddr($bar), ); ok( !$bar->get_error ); } lib000755000764000764 012253555153 20106 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/examples/unicodeunicode.pm100644000764000764 244312253555153 22235 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/examples/unicode/libpackage unicode; use strict; use warnings; use Catalyst::Runtime '5.70'; # Set flags and add plugins for the application # # -Debug: activates the debug mode for very useful log messages # ConfigLoader: will load the configuration from a YAML file in the # application's home directory # Static::Simple: will serve static files from the application's root # directory use Catalyst qw/-Debug ConfigLoader Static::Simple Unicode /; our $VERSION = '0.01'; # Configure the application. # # Note that settings in unicode.yml (or other external # configuration file that you set up manually) take precedence # over this when using ConfigLoader. Thus configuration # details given here can function as a default configuration, # with a external configuration file acting as an override for # local deployment. __PACKAGE__->config( name => 'unicode' ); # Start the application __PACKAGE__->setup; =head1 NAME unicode - Catalyst based application =head1 SYNOPSIS script/unicode_server.pl =head1 DESCRIPTION [enter your description here] =head1 SEE ALSO L, L =head1 AUTHOR Carl Franks =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; Date.pm100644000764000764 4525112253555153 21577 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Elementpackage HTML::FormFu::Element::Date; { $HTML::FormFu::Element::Date::VERSION = '1.00'; } use Moose; use MooseX::Attribute::Chained; extends 'HTML::FormFu::Element::Multi'; use HTML::FormFu::Util qw( _filter_components _parse_args ); use DateTime; use DateTime::Format::Builder; use DateTime::Format::Natural; use DateTime::Locale; use Moose::Util qw( apply_all_roles ); use Scalar::Util qw( blessed ); use List::MoreUtils qw( all none uniq ); use Carp qw( croak ); __PACKAGE__->mk_attrs(qw( day month year )); has auto_inflate => ( is => 'rw', traits => ['Chained'] ); has default_natural => ( is => 'rw', traits => ['Chained'] ); has default_datetime_args => ( is => 'rw', traits => ['Chained'] ); has printf_day => ( is => 'rw', traits => ['Chained'] ); has printf_month => ( is => 'rw', traits => ['Chained'] ); has printf_year => ( is => 'rw', traits => ['Chained'] ); has _known_fields => ( is => 'rw' ); has strftime => ( is => 'rw', default => '%d-%m-%Y', lazy => 1, traits => ['Chained'], ); *default = \&value; # build get_Xs methods for my $method ( qw( deflator filter constraint inflator validator transformer ) ) { my $sub = sub { my $self = shift; my %args = _parse_args(@_); my $get_method = "get_${method}s"; my $accessor = "_${method}s"; my @x = @{ $self->$accessor }; push @x, map { @{ $_->$get_method(@_) } } @{ $self->_elements }; return _filter_components( \%args, \@x ); }; my $name = __PACKAGE__ . "::get_${method}s"; no strict 'refs'; *{$name} = $sub; } after BUILD => sub { my ( $self, $args ) = @_; $self->printf_day('%d'); $self->printf_month('%d'); $self->printf_year('%d'); $self->_known_fields( [qw( day month year )] ); $self->field_order( [qw( day month year )] ); $self->day( { prefix => [], } ); $self->month( { prefix => [], } ); $self->year( { prefix => [], less => 0, plus => 10, reverse => 0, } ); return; }; sub value { my ( $self, $value ) = @_; if ( @_ > 1 ) { $self->{value} = $value; # if we're already built - i.e. process() has ben called, # call default() on our children if ( @{ $self->_elements } ) { $self->_date_defaults; my @order = @{ $self->field_order }; for my $i ( 0 .. $#order ) { my $field = $order[$i]; my $printf_method = "printf_$field"; my $default = $value ? sprintf( $self->$printf_method, $self->$field->{default} ) : undef; $self->_elements->[$i]->default($default); } } return $self; } return $self->{value}; } sub _add_elements { my ($self) = @_; $self->_elements( [] ); $self->_date_defaults; for my $order ( @{ $self->field_order } ) { my $method = "_add_$order"; $self->$method; } if ( $self->auto_inflate && !@{ $self->get_inflators( { type => "DateTime" } ) } ) { _add_inflator($self); } return; } sub _date_defaults { my ($self) = @_; my $default; if ( defined( $default = $self->default ) && length $default ) { if ( !$self->form->submitted || $self->render_processed_value ) { for my $deflator ( @{ $self->_deflators } ) { $default = $deflator->process($default); } } my $is_blessed = blessed($default); if ( !$is_blessed || ( $is_blessed && !$default->isa('DateTime') ) ) { my $builder = DateTime::Format::Builder->new; $builder->parser( { strptime => $self->strftime } ); $default = $builder->parse_datetime($default); } } elsif ( defined( $default = $self->default_natural ) ) { my $parser; if ( defined( my $datetime_args = $self->default_datetime_args ) ) { if ( exists $datetime_args->{set_time_zone} ) { my $tz = $datetime_args->{set_time_zone}; $parser = DateTime::Format::Natural->new( time_zone => $tz ); } else { $parser = DateTime::Format::Natural->new; } } else { $parser = DateTime::Format::Natural->new; } $default = $parser->parse_datetime($default); } else { $default = undef; } if ( defined $default ) { if ( defined( my $datetime_args = $self->default_datetime_args ) ) { for my $key ( keys %$datetime_args ) { $default->$key( $datetime_args->{$key} ); } } for my $field ( @{ $self->field_order } ) { $self->$field->{default} = $default->$field; } } return; } sub _add_day { my ($self) = @_; my $day = $self->day; my $day_name = $self->_build_name('day'); my @day_prefix = ref $day->{prefix} ? @{ $day->{prefix} } : $day->{prefix}; if ( exists $day->{prefix_loc} ) { @day_prefix = ref $day->{prefix_loc} ? map { $self->form->localize($_) } @{ $day->{prefix_loc} } : $self->form->localize( $day->{prefix_loc} ); } @day_prefix = map { [ '', $_ ] } @day_prefix; my $element = $self->element( { type => 'Select', name => $day_name, options => [ @day_prefix, map { [ $_, $_ ] } 1 .. 31 ], attributes => $day->{attributes}, defined $day->{default} ? ( default => $day->{default} ) : (), } ); apply_all_roles( $element, 'HTML::FormFu::Role::Element::MultiElement' ); return; } sub _add_month { my ($self) = @_; my $month = $self->month; my $month_name = $self->_build_name('month'); my @months = _build_month_list($self); my @month_prefix = ref $month->{prefix} ? @{ $month->{prefix} } : $month->{prefix}; if ( exists $month->{prefix_loc} ) { @month_prefix = ref $month->{prefix_loc} ? map { $self->form->localize($_) } @{ $month->{prefix_loc} } : $self->form->localize( $month->{prefix_loc} ); } @month_prefix = map { [ '', $_ ] } @month_prefix; my $options = [ @month_prefix, map { [ $_ + 1, $months[$_] ] } 0 .. 11 ]; my $element = $self->element( { type => 'Select', name => $month_name, options => $options, attributes => $month->{attributes}, defined $month->{default} ? ( default => $month->{default} ) : (), } ); apply_all_roles( $element, 'HTML::FormFu::Role::Element::MultiElement' ); return; } sub _add_year { my ($self) = @_; my $year = $self->year; my $year_name = $self->_build_name('year'); my $year_ref = defined $year->{reference} ? $year->{reference} : ( localtime(time) )[5] + 1900; my @years = defined $year->{list} ? @{ $year->{list} } : ( $year_ref - $year->{less} ) .. ( $year_ref + $year->{plus} ); if ( $year->{reverse} ) { @years = reverse(@years); } my @year_prefix = ref $year->{prefix} ? @{ $year->{prefix} } : $year->{prefix}; if ( exists $year->{prefix_loc} ) { @year_prefix = ref $year->{prefix_loc} ? map { $self->form->localize($_) } @{ $year->{prefix_loc} } : $self->form->localize( $year->{prefix_loc} ); } @year_prefix = map { [ '', $_ ] } @year_prefix; my $element = $self->element( { type => 'Select', name => $year_name, options => [ @year_prefix, map { [ $_, $_ ] } @years ], attributes => $year->{attributes}, defined $year->{default} ? ( default => $year->{default} ) : (), } ); apply_all_roles( $element, 'HTML::FormFu::Role::Element::MultiElement' ); return; } sub _build_month_list { my ($self) = @_; my $month = $self->month; my @months; if ( defined $month->{names} ) { @months = @{ $month->{names} }; } else { my $languages = $self->form->languages; if ( ref $languages ne 'ARRAY' ) { $languages = [$languages]; } for my $lang (@$languages) { my $loc; eval { $loc = DateTime::Locale->load($lang) }; if ( !$@ ) { @months = $month->{short_names} ? @{ $loc->month_format_abbreviated } : @{ $loc->month_format_wide }; @months = map {ucfirst} @months; last; } } } return @months; } sub _build_number_list { my ( $self, $start, $end, $interval ) = @_; $interval ||= 1; my @list; for ( my $i = $start; $i <= $end; $i += $interval ) { push @list, $i; } return @list; } sub _build_name { my ( $self, $type ) = @_; my $name = defined $self->$type->{name} ? $self->$type->{name} : sprintf "%s_%s", $self->name, $type; return $name; } sub _add_inflator { my ($self) = @_; $self->inflator( { type => "DateTime", parser => { strptime => $self->strftime, }, strptime => $self->strftime, } ); return; } sub field_order { my ( $self, @order ) = @_; if ( @_ > 1 ) { if ( @order == 1 && ref( $order[0] ) eq 'ARRAY' ) { @order = @{ $order[0] }; } for my $field (@order) { croak "unknown field type: '$field'" if none { $field eq $_ } @{ $self->_known_fields }; } croak 'repeated field type' if scalar( uniq @order ) != scalar(@order); $self->{field_order} = \@order; return $self; } else { return $self->{field_order}; } } sub process { my ( $self, @args ) = @_; $self->_add_elements; return $self->SUPER::process(@args); } sub process_input { my ( $self, $input ) = @_; my %value; my @order = @{ $self->field_order }; for my $i ( 0 .. $#order ) { my $field = $order[$i]; my $name = $self->_elements->[$i]->nested_name; $value{$field} = $self->get_nested_hash_value( $input, $name ); } if ( ( all {defined} values %value ) && all {length} values %value ) { my $dt; eval { $dt = DateTime->new( map { $_, $value{$_} } keys %value ); }; my $value; if ($@) { $value = $self->strftime; } else { $value = $dt->strftime( $self->strftime ); } $self->set_nested_hash_value( $input, $self->nested_name, $value ); } return $self->SUPER::process_input($input); } sub render_data { return shift->render_data_non_recursive(@_); } sub render_data_non_recursive { my ( $self, $args ) = @_; my $render = $self->SUPER::render_data_non_recursive( { elements => [ map { $_->render_data } @{ $self->_elements } ], $args ? %$args : (), } ); return $render; } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Element::Date - 3 select menu multi-field =head1 SYNOPSIS --- elements: - type: Date name: birthdate label: 'Birthdate:' day: prefix: "- Day -" month: prefix: "- Month -" year: prefix: "- Year -" less: 70 plus: 0 auto_inflate: 1 =head1 DESCRIPTION Creates a L element containing 3 select menus for the day, month and year. A date element named C would result in 3 select menus with the names C, C and C. The names can instead be overridden by the C value in L, L and L. This element automatically merges the input parameters from the select menu into a single date parameter (and doesn't delete the individual menu's parameters). =head1 METHODS =head2 default Arguments: DateTime object Arguments: $date_string Accepts either a L object, or a string containing a date, matching the L
format. Overwrites any default value set in L, L or L. =head2 default_natural Arguments: $date_string - type: Date default_natural: 'today' Accepts a date/time string suitable for passing to L. =head2 default_datetime_args - type: Date default_natural: 'today' default_datetime_args: set_time_zone: 'Europe/London' Accepts a hashref of method-names / values that will be called on the L
L object, before the select fields' values are set from it. =head2 strftime Default Value: "%d-%m-%Y" The format of the date as returned by L, if L is not set. If L is used, this is still the format that the parameter will be in prior to the DateTime inflator being run; which is what any L and L will receive. =head2 day Arguments: \%setting Set values effecting the C select menu. Known keys are: =head3 name Override the auto-generated name of the select menu. =head3 default Set the default value of the select menu =head3 prefix Arguments: $value Arguments: \@values A string or arrayref of strings to be inserted into the start of the select menu. Each value is only used as the label for a select item - the value for each of these items is always the empty string C<''>. =head3 prefix_loc Arguments: $localization_key Arguments: \@localization_keys A localized string or arrayref of localized strings to be inserted into the start of the select menu. Each value is localized and then only used as the label for a select item - the value for each of these items is always the empty string C<''>. Use C insted of C. =head2 month Arguments: \%setting Set values effecting the C select menu. Known keys are: =head3 name Override the auto-generated name of the select menu. =head3 default Set the default value of the select menu =head3 prefix Arguments: $value Arguments: \@values A string or arrayref of strings to be inserted into the start of the select menu. Each value is only used as the label for a select item - the value for each of these items is always the empty string C<''>. =head3 prefix_loc Arguments: $localization_key Arguments: \@localization_keys A localized string or arrayref of localized strings to be inserted into the start of the select menu. Each value is localized and then only used as the label for a select item - the value for each of these items is always the empty string C<''>. Use C insted of C. =head3 names Arguments: \@months A list of month names used for the month menu. If not set, the list of month names is obtained from L using the locale set in L. =head3 short_names Argument: bool If true (and C is not set) the list of abbreviated month names is obtained from L using the locale set in L. =head2 year Arguments: \%setting Set values effecting the C select menu. Known keys are: =head3 name Override the auto-generated name of the select menu. =head3 default Set the default value of the select menu =head3 prefix Arguments: $value Arguments: \@values A string or arrayref of strings to be inserted into the start of the select menu. Each value is only used as the label for a select item - the value for each of these items is always the empty string C<''>. =head3 prefix_loc Arguments: $localization_key Arguments: \@localization_keys A localized string or arrayref of localized strings to be inserted into the start of the select menu. Each value is localized and then only used as the label for a select item - the value for each of these items is always the empty string C<''>. Use C insted of C. =head3 list Arguments: \@years A list of years used for the year menu. If this is set, C, C and C are ignored. =head3 reference Arguments: $year Default Value: the current year, calculated from L If C is not set, the list is created from the range of C to C. =head3 less Arguments: $count Default Value: 0 =head3 plus Arguments: $count Default Value: 10 =head3 reverse Arguments: bool Default Value: 0 If true, the list of years is listed in reverse (decreasing) order. =head2 field_order Arguments: \@fields Default Value: ['day', 'month', 'year'] Specify the order of the date fields in the rendered HTML. Not all 3 fields are required. No single field can be used more than once. =head2 auto_inflate If true, a L will automatically be added to the element, and it will be given a formatter so that stringification will result in the format specified in L. If you require the DateTime Inflator to have a different stringification format to the format used internally by your Filters and Constraints, then you must explicitly add your own DateTime Inflator, rather than using L. =head1 CAVEATS Although this element inherits from L, its behaviour for the methods L, L, L, L and L is more like that of a L, meaning all processors are added directly to the date element, not to its select-menu child elements. This element's L and L are inherited from L, and so have the same behaviour. However, it overrides the C method, such that it returns both itself and its child elements. =head1 SEE ALSO Is a sub-class of, and inherits methods from L, L, L, L L =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut File.pm100644000764000764 234412253555153 21555 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Elementpackage HTML::FormFu::Element::File; { $HTML::FormFu::Element::File::VERSION = '1.00'; } use Moose; extends 'HTML::FormFu::Element'; with 'HTML::FormFu::Role::Element::Input'; after BUILD => sub { my $self = shift; $self->field_type('file'); $self->form->enctype('multipart/form-data'); return; }; __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Element::File - File upload form field =head1 SYNOPSIS --- elements: type: File name: photo my $photo = $form->param('photo'); my $blob = $photo->slurp; =head1 DESCRIPTION File upload form field. See the documentation relevant to the L you're using: =over =item L =item L =item L =back =head1 METHODS =head1 SEE ALSO Is a sub-class of, and inherits methods from L, L, L L =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Text.pm100644000764000764 153012253555153 21616 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Elementpackage HTML::FormFu::Element::Text; { $HTML::FormFu::Element::Text::VERSION = '1.00'; } use Moose; extends 'HTML::FormFu::Element'; with 'HTML::FormFu::Role::Element::Input'; after BUILD => sub { my $self = shift; $self->field_type('text'); return; }; __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Element::Text - Text form field =head1 SYNOPSIS my $element = $form->element( Text => 'foo' ); =head1 DESCRIPTION Text form field. =head1 SEE ALSO Is a sub-class of, and inherits methods from L, L, L. L =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Filter000755000764000764 012253555153 20031 5ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFuRegex.pm100644000764000764 337112253555153 21605 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Filterpackage HTML::FormFu::Filter::Regex; { $HTML::FormFu::Filter::Regex::VERSION = '1.00'; } use Moose; use MooseX::Attribute::Chained; extends 'HTML::FormFu::Filter'; use HTML::FormFu::Constants qw( $EMPTY_STR ); has match => ( is => 'rw', traits => ['Chained'] ); has replace => ( is => 'rw', traits => ['Chained'] ); has eval => ( is => 'rw', traits => ['Chained'] ); sub filter { my ( $self, $value ) = @_; return if !defined $value; my $match = defined $self->match ? $self->match : qr/./; my $replace = defined $self->replace ? $self->replace : $EMPTY_STR; if ( $self->eval ) { $value =~ s/$match/$replace/gee; } else { $value =~ s/$match/$replace/g; } return $value; } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Filter::Regex - regexp-based match/replace filter =head1 SYNOPSIS The following filter would turn C<1234-5678> into C<****-****>. type: Regex match: \d replace: * =head1 DESCRIPTION Regular expression-based match / replace filter. =head1 METHODS =head2 match A regex object or string to be used in the "left-hand side" of a C regular expression. Default Value: qr/./ =head2 replace A string to be used in the "right-hand side" of a C regular expression. The string will replace every occurrence of L. Default Value: '' =head2 eval Arguments: $bool If true, the regex modifier C is used, so that the contents of the L string are C'd. This allows the use of variables such as C<$1> or any other perl expression. =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut Split.pm100644000764000764 231412253555153 21622 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/lib/HTML/FormFu/Filterpackage HTML::FormFu::Filter::Split; { $HTML::FormFu::Filter::Split::VERSION = '1.00'; } use Moose; use MooseX::Attribute::Chained; extends 'HTML::FormFu::Filter'; has regex => ( is => 'rw', traits => ['Chained'] ); has limit => ( is => 'rw', traits => ['Chained'] ); sub filter { my ( $self, $value ) = @_; return if !defined $value; my $regex = $self->regex; my $limit = $self->limit || 0; $regex = '' if !defined $regex; my @values = split /$regex/, $value, $limit; return if !@values; return \@values; } __PACKAGE__->meta->make_immutable; 1; __END__ =head1 NAME HTML::FormFu::Filter::Split - filter splitting a singe value into an arrayref =head1 SYNOPSIS type: Split regex: '-' =head1 DESCRIPTION Split a single input value into an arrayref of values. =head1 METHODS =head2 regex A regex object or string to be passed as the C argument to C. Default Value: '' (emtpy string) =head2 limit A number passed as the C argument to C. Default Value: 0 =head1 AUTHOR Carl Franks, C =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut errors100644000764000764 60712253555153 22341 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/share/templates/tt/xhtml[% IF self.errors %][% IF self.error_container_tag.defined %]<[% self.error_container_tag %][% process_attrs(self.error_container_attributes) %]> [% END %][% FOREACH error = self.errors %] <[% self.error_tag %][% process_attrs(error.attributes) %]>[% error.message %][% END %][% IF self.error_container_tag.defined %] \&_myblockrole_attrs; around attrs => \&_myblockrole_attrs; around attributes_xml => \&_myblockrole_attrs; around attrs_xml => \&_myblockrole_attrs; my $key = 'class'; my $value = 'myblockrole'; sub _myblockrole_attrs { my $orig = shift; my $self = shift; if (@_) { return $self->$orig(@_); } my $attrs = $self->{attributes}; my $done; if ( exists $attrs->{$key} ) { my @vals = split /\s+/, $attrs->{$key}; if ( first { $_ eq $value } @vals ) { $done = 1; } } if ( !$done ) { $self->add_attrs({ $key => $value }); } return $attrs; }; 1; MyFieldRole.pm100644000764000764 146612253555153 21650 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t/lib/HTMLFormFupackage HTMLFormFu::MyFieldRole; use Moose::Role; around container_attributes => \&_myfieldrole_attrs; around container_attrs => \&_myfieldrole_attrs; around container_attributes_xml => \&_myfieldrole_attrs; around container_attrs_xml => \&_myfieldrole_attrs; my $key = 'class'; my $value = 'myfieldrole'; sub _myfieldrole_attrs { my $orig = shift; my $self = shift; if (@_) { return $self->$orig(@_); } my $attrs = $self->{container_attributes}; my $done; if ( exists $attrs->{$key} ) { my @vals = split /\s+/, $attrs->{$key}; if ( first { $_ eq $value } @vals ) { $done = 1; } } if ( !$done ) { $self->add_container_attrs({ $key => $value }); } return $attrs; }; 1; MyValidator.pm100644000764000764 40112253555153 21674 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t/lib/HTMLFormFupackage HTMLFormFu::MyValidator; use strict; use warnings; use base 'HTML::FormFu::Validator'; sub validate_value { my ( $self, $value, $params ) = @_; die HTML::FormFu::Exception::Validator->new if $value eq 'foo'; return 1; } 1; field_change_name.t100644000764000764 42712253555153 22163 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregateuse strict; use warnings; use Test::More tests => 2; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo')->constraint('Required'); ok( $form->get_constraint('foo') ); $form->get_field('foo')->name('bar'); ok( $form->get_constraint('bar') ); ascii.t100644000764000764 113512253555153 22247 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 4; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->constraint('ASCII'); # Valid { $form->process( { foo => 'aaa', bar => 'bbbbbbb', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); } # Invalid { $form->process( { foo => 'aaa', bar => '日本語', } ); ok( $form->valid('foo'), 'foo valid' ); ok( !$form->valid('bar'), 'bar not valid' ); } email.t100644000764000764 61312253555153 22226 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 2; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo')->constraint('Email'); # Valid { $form->process( { foo => 'cfranks@cpan.org', } ); ok( $form->valid('foo'), 'foo valid' ); } # Invalid { $form->process( { foo => 'cfranks@cpan', } ); ok( $form->has_errors('foo'), 'foo has errors' ); } equal.t100644000764000764 414712253555153 22274 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 21; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo')->constraint('Equal') ->others( [ 'bar', 'baz' ] ); $form->element('Text')->name('bar'); $form->element('Text')->name('baz'); # Valid { $form->process( { foo => 'yada', bar => 'yada', baz => 'yada', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( $form->valid('baz'), 'baz valid' ); } # Valid { $form->process( { foo => '', bar => '', baz => '', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( $form->valid('baz'), 'baz valid' ); } # Valid { $form->process( { foo => [ 'a', 'b' ], bar => [ 'a', 'b' ], baz => [ 'b', 'a' ], } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( $form->valid('baz'), 'baz valid' ); } # Invalid { $form->process( { foo => 'yada', bar => 'yada', baz => 'x', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( !$form->valid('baz'), 'baz not valid' ); } # Invalid { $form->process( { foo => 'yada', bar => 'yada', baz => '', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( !$form->valid('baz'), 'baz not valid' ); } # Invalid { $form->process( { foo => '', bar => 'yada', baz => 'yada', } ); ok( $form->valid('foo'), 'foo valid' ); ok( !$form->valid('bar'), 'bar not valid' ); ok( !$form->valid('baz'), 'baz not valid' ); } # Invalid { $form->process( { foo => [ 'a', 'b' ], bar => [ 'a', 'b' ], baz => ['a'], } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( !$form->valid('baz'), 'baz not valid' ); } range.t100644000764000764 116312253555153 22254 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 4; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo')->constraint('Range')->min(3)->max(5); $form->element('Text')->name('bar')->constraint('Range')->min(3)->max(5); # Valid { $form->process( { foo => 3, bar => 4, } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); } # Invalid { $form->process( { foo => 1, bar => 6, } ); ok( !$form->valid('foo'), 'foo not valid' ); ok( !$form->valid('bar'), 'bar not valid' ); } regex.t100644000764000764 140312253555153 22267 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/constraintsuse strict; use warnings; use Test::More tests => 8; use HTML::FormFu; my $form = HTML::FormFu->new; $form->element('Text')->name('foo'); $form->element('Text')->name('bar'); $form->constraint('Regex'); # Valid { $form->process( { foo => 'aaa', bar => 'bbbbbbb', } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'bar valid' ); ok( grep { $_ eq 'foo' } $form->valid ); ok( grep { $_ eq 'bar' } $form->valid ); } # "0" is valid { $form->process( { foo => 0, bar => 2, } ); ok( $form->valid('foo'), 'foo valid' ); ok( $form->valid('bar'), 'foo valid' ); ok( grep { $_ eq 'foo' } $form->valid ); ok( grep { $_ eq 'bar' } $form->valid ); } checkbox.t100644000764000764 236412253555153 22217 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/elementsuse strict; use warnings; use Test::More tests => 6; use HTML::FormFu; my $form = HTML::FormFu->new( { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } ); my $foo = $form->element('Checkbox')->name('foo')->value('foox'); # add more elements to test accessor output my $bar = $form->element('Checkbox')->name('bar')->value('barx'); my $moo = $form->element('Checkbox')->name('moo')->value('moox')->default('moox'); my $fad = $form->element('Checkbox')->name('fad')->value('fadx')->default('fadx'); my $field_xhtml = qq{
}; is( "$foo", $field_xhtml, 'field xhtml' ); my $form_xhtml = < $field_xhtml
EOF is( "$form", $form_xhtml, 'stringified form' ); # With mocked basic query { $form->process( { foo => 'foox', moo => 'moox', } ); like( "$foo", qr/checked/ ); unlike( "$bar", qr/checked/ ); like( "$moo", qr/checked/ ); unlike( "$fad", qr/checked/ ); } combobox.t100644000764000764 413312253555153 22235 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/elementsuse strict; use warnings; use Test::More tests => 9; use HTML::FormFu; my $form = HTML::FormFu->new( { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } ); $form->load_config_file('t-aggregate/elements/combobox.yml'); { $form->process; is( $form->get_element( { type => 'ComboBox' } ), qq{
} ); } { $form->get_element( { type => 'ComboBox' } )->default('one'); $form->process; is( $form->get_element( { type => 'ComboBox' } ), qq{
} ); } { $form->get_element( { type => 'ComboBox' } )->default('four'); $form->process; is( $form->get_element( { type => 'ComboBox' } ), qq{
} ); } # valid select value { $form->process( { combo_select => 'one', combo_text => '', } ); ok( $form->submitted_and_valid ); is( $form->param_value('combo'), 'one' ); } # valid text value { $form->process( { combo_select => '', combo_text => 'four', } ); ok( $form->submitted_and_valid ); is( $form->param_value('combo'), 'four' ); } # valid - text is used in preference to select value { $form->process( { combo_select => 'one', combo_text => 'four', } ); ok( $form->submitted_and_valid ); is( $form->param_value('combo'), 'four' ); } datetime.t100644000764000764 4643412253555153 22253 0ustar00cafrankscafranks000000000000HTML-FormFu-1.00/t-aggregate/elementsuse strict; use warnings; use Test::More tests => 16; use HTML::FormFu; use DateTime; my $dt = DateTime->new( day => 6, month => 8, year => 2007, hour => 1, minute => 0, ); my $form = HTML::FormFu->new( { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } ); $form->load_config_file('t-aggregate/elements/datetime.yml'); $form->get_field('foo')->default($dt); $form->process; is( "$form", <
HTML $form->process( { foo_hour => '00', foo_minute => '00', foo_day => 30, foo_month => 6, foo_year => 2007, bar_hour => '01', bar_minute => '30', bar_day => 1, bar_month => 7, bar_year => 2007, } ); ok( $form->submitted_and_valid ); my $foo = $form->param('foo'); my $bar = $form->param('bar'); isa_ok( $foo, 'DateTime' ); ok( !ref $bar ); is( $foo, "06/30/2007 00:00" ); is( $bar, "01-07-2007 01:30" ); like( $form->get_field('foo'), qr/\Q