[libcgi-formbuilder-perl] 01/02: Merge patches 0005-0006 into 0004, and adapt to retain support for objects that mimic the CGI.pm API but do not have param_fetch. Closes: bug#769240. Thanks to Simon McVittie.

Jonas Smedegaard dr at jones.dk
Sat Nov 15 15:06:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libcgi-formbuilder-perl.

commit ec536f51027edaab4def639ee9a999d20a689064
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Sat Nov 15 15:58:34 2014 +0100

    Merge patches 0005-0006 into 0004, and adapt to retain support for objects that mimic the CGI.pm API but do not have param_fetch. Closes: bug#769240. Thanks to Simon McVittie.
---
 ...nneeded-warning-from-CGI.pm-4.05-or-newer.patch | 72 +++++++++++++++++++---
 ...nneeded-warning-from-CGI.pm-4.05-or-newer.patch | 20 ------
 ...-use-of-param-that-will-cause-a-warning-i.patch | 19 ------
 ...t-cgi_param-is-context-sensitive-just-lik.patch |  2 +-
 debian/patches/series                              |  2 -
 5 files changed, 65 insertions(+), 50 deletions(-)

diff --git a/debian/patches/0004-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch b/debian/patches/0004-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
index 0395cab..1c66512 100644
--- a/debian/patches/0004-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
+++ b/debian/patches/0004-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
@@ -1,20 +1,76 @@
-From: Amitai Schlair <schmonz-web-ikiwiki at schmonz.com>
-Date: Thu, 16 Oct 2014 10:33:57 +0100
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 12 Nov 2014 20:41:26 +0000
 Subject: Avoid unneeded warning from CGI.pm 4.05 or newer
 
-Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/p5-CGI-FormBuilder/patches/patch-lib_CGI_FormBuilder.pm?rev=1.1&content-type=text/plain
----
- lib/CGI/FormBuilder.pm | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+Based on earlier patches by Amitai Schlair, but modified to retain
+support for objects like Catalyst::Request that mimic the CGI interface
+but do not have a param_fetch method.
 
 --- a/lib/CGI/FormBuilder.pm
 +++ b/lib/CGI/FormBuilder.pm
-@@ -855,7 +855,7 @@
+@@ -855,7 +855,18 @@
  
      # Make sure to get all values
      for my $p (@keep) {
 -        for my $v ($self->{params}->param($p)) {
-+        for my $v (@{$self->{params}->param_fetch($p)}) {
++        my @values;
++        if ($self->{params}->can('param_fetch')) {
++            @values = @{$self->{params}->param_fetch($p)};
++        }
++        else {
++            # array-context calls to param($p) are deprecated in
++            # CGI.pm, but some other objects that mimic
++            # its interface don't have param_fetch
++            @values = $self->{params}->param($p);
++        }
++
++        for my $v (@values) {
              debug 1, "keepextras: saving hidden param $p = $v";
              push @html, htmltag('input', name => $p, type => 'hidden', value => $v);
          }
+--- a/lib/CGI/FormBuilder/Field.pm
++++ b/lib/CGI/FormBuilder/Field.pm
+@@ -189,7 +189,19 @@
+     my $self = shift;
+     debug 2, "$self->{name}: called \$field->cgi_value";
+     puke "Cannot set \$field->cgi_value manually" if @_;
+-    if (my @v = $self->{_form}{params}->param($self->name)) {
++
++    my @v;
++    if ($self->{_form}{params}->can('param_fetch')) {
++        @v = @{$self->{_form}{params}->param_fetch($self->name)};
++    }
++    else {
++        # array-context calls to param($p) are deprecated in
++        # CGI.pm, but some other objects that mimic
++        # its interface don't have param_fetch
++        @v = $self->{_form}{params}->param($self->name);
++    }
++
++    if (@v) {
+         for my $v (@v) {
+             if ($self->other && $v eq $self->othername) {
+                 debug 1, "$self->{name}: redoing value from _other field";
+--- a/lib/CGI/FormBuilder/Multi.pm
++++ b/lib/CGI/FormBuilder/Multi.pm
+@@ -218,7 +218,19 @@
+         }
+         for my $k (@{$self->{keepextras}}) {
+             next if $k eq $pnam;
+-            for my $v ($self->{params}->param($k)) {
++
++            my @values;
++            if ($self->{params}->can('param_fetch')) {
++                @values = @{$self->{params}->param_fetch($k)};
++            }
++            else {
++                # array-context calls to param($k) are deprecated in
++                # CGI.pm, but some other objects that mimic
++                # its interface don't have param_fetch
++                @values = $self->{params}->param($k);
++            }
++
++            for my $v (@values) {
+                 push @keep, { name => $k, value => $v };
+             }
+         }
diff --git a/debian/patches/0005-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch b/debian/patches/0005-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
deleted file mode 100644
index aaedac9..0000000
--- a/debian/patches/0005-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From: Amitai Schlair <schmonz-web-ikiwiki at schmonz.com>
-Date: Thu, 16 Oct 2014 10:34:45 +0100
-Subject: Avoid unneeded warning from CGI.pm 4.05 or newer
-
-Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/p5-CGI-FormBuilder/patches/patch-lib_CGI_FormBuilder_Field.pm?rev=1.1&content-type=text/plain
----
- lib/CGI/FormBuilder/Field.pm | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/lib/CGI/FormBuilder/Field.pm
-+++ b/lib/CGI/FormBuilder/Field.pm
-@@ -189,7 +189,7 @@
-     my $self = shift;
-     debug 2, "$self->{name}: called \$field->cgi_value";
-     puke "Cannot set \$field->cgi_value manually" if @_;
--    if (my @v = $self->{_form}{params}->param($self->name)) {
-+    if (my @v = @{$self->{_form}{params}->param_fetch($self->name)}) {
-         for my $v (@v) {
-             if ($self->other && $v eq $self->othername) {
-                 debug 1, "$self->{name}: redoing value from _other field";
diff --git a/debian/patches/0006-Fix-another-use-of-param-that-will-cause-a-warning-i.patch b/debian/patches/0006-Fix-another-use-of-param-that-will-cause-a-warning-i.patch
deleted file mode 100644
index 5599f44..0000000
--- a/debian/patches/0006-Fix-another-use-of-param-that-will-cause-a-warning-i.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From: Simon McVittie <smcv at debian.org>
-Date: Thu, 16 Oct 2014 10:39:16 +0100
-Subject: Fix another use of param that will cause a warning in recent CGI.pm
-
----
- lib/CGI/FormBuilder/Multi.pm | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/lib/CGI/FormBuilder/Multi.pm
-+++ b/lib/CGI/FormBuilder/Multi.pm
-@@ -218,7 +218,7 @@
-         }
-         for my $k (@{$self->{keepextras}}) {
-             next if $k eq $pnam;
--            for my $v ($self->{params}->param($k)) {
-+            for my $v (@{$self->{params}->param_fetch($k)}) {
-                 push @keep, { name => $k, value => $v };
-             }
-         }
diff --git a/debian/patches/0007-Comment-that-cgi_param-is-context-sensitive-just-lik.patch b/debian/patches/0007-Comment-that-cgi_param-is-context-sensitive-just-lik.patch
index 5fb4d12..0bfc8d7 100644
--- a/debian/patches/0007-Comment-that-cgi_param-is-context-sensitive-just-lik.patch
+++ b/debian/patches/0007-Comment-that-cgi_param-is-context-sensitive-just-lik.patch
@@ -8,7 +8,7 @@ Subject: Comment that cgi_param is context-sensitive just like param
 
 --- a/lib/CGI/FormBuilder.pm
 +++ b/lib/CGI/FormBuilder.pm
-@@ -1175,6 +1175,8 @@
+@@ -1186,6 +1186,8 @@
  
  sub cgi_param {
      my $self = shift;
diff --git a/debian/patches/series b/debian/patches/series
index af743c0..b90bcc8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,4 @@
 pod-encoding.patch
 pod-spelling.patch
 0004-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
-0005-Avoid-unneeded-warning-from-CGI.pm-4.05-or-newer.patch
-0006-Fix-another-use-of-param-that-will-cause-a-warning-i.patch
 0007-Comment-that-cgi_param-is-context-sensitive-just-lik.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-formbuilder-perl.git



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