r74337 - in /branches/upstream/libhtml-formfu-perl/current: ./ lib/HTML/ lib/HTML/FormFu/ lib/HTML/FormFu/Manual/ lib/HTML/FormFu/Model/

ansgar at users.alioth.debian.org ansgar at users.alioth.debian.org
Fri May 13 18:18:37 UTC 2011


Author: ansgar
Date: Fri May 13 18:18:20 2011
New Revision: 74337

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74337
Log:
[svn-upgrade] new version libhtml-formfu-perl (0.09003)

Modified:
    branches/upstream/libhtml-formfu-perl/current/Changes
    branches/upstream/libhtml-formfu-perl/current/META.yml
    branches/upstream/libhtml-formfu-perl/current/Makefile.PL
    branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm
    branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Constraint.pm
    branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Deploy.pm
    branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Manual/Cookbook.pod
    branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Model/HashRef.pm
    branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Plugin.pm

Modified: branches/upstream/libhtml-formfu-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/Changes?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/Changes (original)
+++ branches/upstream/libhtml-formfu-perl/current/Changes Fri May 13 18:18:20 2011
@@ -1,3 +1,7 @@
+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

Modified: branches/upstream/libhtml-formfu-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/META.yml?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/META.yml (original)
+++ branches/upstream/libhtml-formfu-perl/current/META.yml Fri May 13 18:18:20 2011
@@ -50,6 +50,7 @@
   Locale::Maketext: 0
   Module::Pluggable: 0
   Moose: 1.00
+  Moose::Meta::Attribute::Custom::Trait::Chained: 0
   MooseX::Aliases: 0
   MooseX::ChainedAccessors::Accessor: 0.02
   MooseX::SetOnce: 0
@@ -64,4 +65,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://github.com/fireartist/HTML-FormFu.git
-version: 0.09002
+version: 0.09003

Modified: branches/upstream/libhtml-formfu-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/Makefile.PL?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/Makefile.PL (original)
+++ branches/upstream/libhtml-formfu-perl/current/Makefile.PL Fri May 13 18:18:20 2011
@@ -102,6 +102,7 @@
 requires 'Locale::Maketext';
 requires 'Module::Pluggable';
 requires 'Moose' => '1.00'; # Reasonable default until we get test results
+requires 'Moose::Meta::Attribute::Custom::Trait::Chained';
 requires 'MooseX::Aliases';
 requires 'MooseX::ChainedAccessors::Accessor' => '0.02'; # for more recent Moose
 requires 'MooseX::SetOnce';
@@ -130,7 +131,7 @@
 # This fixes the problem of tar files having world-writable files,
 # which causes PAUSE to choke
 eval {
-    use_ptar() if author_context && $^O =~/win/i;
+    use_ptar() if author_context && $^O =~/(?:ms|cyg)win/i;
 };
 if ($@) {
     die "Module::Install::PerlTar must be installed when Makefile.PL is run by an author on MS Windows\n";

Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm Fri May 13 18:18:20 2011
@@ -141,7 +141,7 @@
 *plugins           = \&plugin;
 *add_plugins       = \&add_plugin;
 
-our $VERSION = '0.09002';
+our $VERSION = '0.09003';
 $VERSION = eval $VERSION;
 
 sub BUILD {

Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Constraint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Constraint.pm?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Constraint.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Constraint.pm Fri May 13 18:18:20 2011
@@ -2,7 +2,6 @@
 
 use strict;
 use base 'HTML::FormFu::Processor';
-use Class::C3;
 use Moose;
 extends 'HTML::FormFu::Processor';
 

Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Deploy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Deploy.pm?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Deploy.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Deploy.pm Fri May 13 18:18:20 2011
@@ -105,6 +105,5 @@
     return;
 }
 
-__PACKAGE__->meta->make_immutable;
 
 1;

Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Manual/Cookbook.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Manual/Cookbook.pod?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Manual/Cookbook.pod (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Manual/Cookbook.pod Fri May 13 18:18:20 2011
@@ -412,6 +412,97 @@
 If you would like the field to contain the filtered value, use 
 L<HTML::FormFu/render_processed_value>.
 
+=head2 Multiple forms using Catalyst::Controller::HTML::FormFu
+
+Sometimes you need to display multiple forms on a single page. If you
+try to use FormConfig on several actions in a chain, or similar, they
+all use C<< $c->stash->{form} >> to store the form, hence you only get the last
+form.
+
+One way to work around such problems is to do a little of the work yourself:
+
+In this example we have a login_form that we want on every page
+
+    # root/forms/login.yml:
+    ---
+        indicator: username
+        elements:
+            -
+                type: Text
+                name: username
+                constraints:
+                    - Required
+    ...
+
+We also have an edit-form
+
+    # root/forms/foo/edit.yml
+    ---
+        indicator: foo
+        elements:
+        -
+            type: Text
+            name: foo
+            constraints:
+                - Required
+    ...
+
+In this example, we want the login form to appear on every page, so
+we load this in the top-most auto action:
+
+    package MyApp::Controller::Root;
+
+    BEGIN { extends 'Catalyst::Controller::HTML::FormFu'; }
+
+    sub auto : Private {
+        my ($self, $c) = @_;
+
+        # We want to utilize alot of the magic that the controller
+        # gives us, so therefore we call $self->form like this
+
+        my $login_form = $self->form;
+        $login_form->load_config_file('login.yml');
+
+        # Notice how we put it into another stash var, not 'form'
+        $c->stash->{login_form} = $login_form;
+        unless ($c->user_exists) {
+
+            $login_form->process();
+
+            if ($login_form->submitted_and_valid) {
+
+                # Since we set indicator, we should only end up here if we
+                # have a username in the form
+                $c->authenticate({
+                    username => $login_form->param_value('username'),
+                    password => $login_form->param_value('password'),
+                });
+            }
+
+        }
+    }
+
+
+Any other page that wants to load another form, can now do so freely:
+
+    package MyApp::Controller::Foo;
+
+    sub edit : Local FormConfig {
+        my ( $self, $c ) = @_;
+
+        my $form = $c->stash->{form};
+        if ($form->submitted_and_valid) {
+            # Do whatever you want with it :p
+        }
+    }
+
+In the view we now have two stash-variables:
+
+In F<root/foo/edit.tt>:
+    [% login_form %]
+    <h2>edit</h2>
+    [% form %]
+
 =head1 ADVANCED CUSTOMISATION
 
 =head2 Installing the TT templates

Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Model/HashRef.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Model/HashRef.pm?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Model/HashRef.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Model/HashRef.pm Fri May 13 18:18:20 2011
@@ -168,6 +168,7 @@
 sub _escape_hash {
     my $hash = shift;
     my $method = shift || \&_escape_name;
+    return $hash unless(ref $hash);
     foreach my $k (keys %$hash) {
         my $v = delete $hash->{$k};
         if(ref $v eq 'HASH') {
@@ -297,8 +298,6 @@
 
 __PACKAGE__->meta->make_immutable;
 
-1;
-
 __END__
 
 =head1 NAME

Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Plugin.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Plugin.pm?rev=74337&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Plugin.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Plugin.pm Fri May 13 18:18:20 2011
@@ -58,6 +58,13 @@
 
 For field plugins, is called during the field's C<process> call.
 
+=head2 pre_process
+
+For form plugins, is called immediately after C<pre_process>
+is run on the elements.
+
+For element plugins, is called before C<pre_process> is run on form plugins.
+
 =head2 post_process
 
 For form plugins, is called immediately before L<HTML::FormFu/process>




More information about the Pkg-perl-cvs-commits mailing list