[libnet-openid-common-perl] 02/04: allow Plack::Request parameter objects for IndirectMessage
gregor herrmann
gregoa at debian.org
Sun Feb 7 21:50:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to annotated tag v1.11
in repository libnet-openid-common-perl.
commit eec079d3f4d719c1e12c61302a17840bc16c1bda
Author: Roger Crew <crew at cs.stanford.edu>
Date: Sat Oct 22 16:41:27 2011 -0700
allow Plack::Request parameter objects for IndirectMessage
---
lib/Net/OpenID/IndirectMessage.pm | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/lib/Net/OpenID/IndirectMessage.pm b/lib/Net/OpenID/IndirectMessage.pm
index 37e7bf8..16e4b8e 100644
--- a/lib/Net/OpenID/IndirectMessage.pm
+++ b/lib/Net/OpenID/IndirectMessage.pm
@@ -47,6 +47,11 @@ sub new {
$getter = sub { scalar $what->param($_[0]); };
$enumer = sub { $what->param; };
}
+ elsif (ref $what eq "Plack::Request") {
+ my $p = $what->method eq 'POST' ? $what->body_parameters : $what->query_parameters;
+ $getter = sub { $p->get($_[0]); };
+ $enumer = sub { keys %{$p}; };
+ }
elsif (ref $what eq "CODE") {
$getter = $what;
# We can't enumerate with just a coderef.
@@ -214,16 +219,19 @@ acts as if the relevant namespaces were present. In this case, it only
supports the basic OpenID 1.1 arguments and the extension arguments
for Simple Registration.
-This class can operate on a normal hashref, a L<CGI> object, an L<Apache>
-object, an L<Apache::Request> object, an L<Apache2::Request> object or an
-arbitrary C<CODE> ref that takes a key name as its first parameter and returns
-a value. However, if you use a coderef then extension arguments are not
-supported.
+This class can operate on
+a normal hashref,
+a L<CGI> object,
+an L<Apache> object,
+an L<Apache::Request> object,
+an L<Apache2::Request> object,
+a L<Plack::Request> object, or
+an arbitrary C<CODE> ref that takes a key name as its first parameter and returns a value.
+However, if you use a coderef then extension arguments are not supported.
If you pass in a hashref or a coderef it is your responsibility as the caller
-to check the HTTP request method and pass in the correct set of arguments. If
-you use an Apache, Apache::Request, Apache2::Request or CGI object then this
-module will do the right thing automatically.
+to check the HTTP request method and pass in the correct set of arguments.
+For the other kinds of objects, this module will do the right thing automatically.
=head1 SYNOPSIS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-openid-common-perl.git
More information about the Pkg-perl-cvs-commits
mailing list