Debian Codegraph @

lemonldap-ng-common/lib/Lemonldap/NG/Common/FormEncode.pm

raw
1 package Lemonldap::NG::Common::FormEncode;
2
3 use strict;
4 use Exporter;
5
6 our @ISA = qw(Exporter);
7 our $VERSION = '2.0.0';
8
9 our @EXPORT_OK = qw(build_urlencoded);
10 our @EXPORT = qw(build_urlencoded);
11
12 BEGIN {
13 require Plack::Request;
14 if ( $Plack::Request::VERSION < '1.0040' ) {
15 require URI::Escape;
16 eval <<'EOT';
17 sub build_urlencoded {
18 my(%h)=@_;
19 return join('&',map {my $v=URI::Escape::uri_escape($h{$_});"$_=$v"} keys %h);
20 }
21 EOT
22 }
23 else {
24 require WWW::Form::UrlEncoded;
25 *build_urlencoded = \&WWW::Form::UrlEncoded::build_urlencoded;
26 }
27 }
28
29 1;