You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
649 B
35 lines
649 B
|
9 years ago
|
package Lemonldap::NG::Common::FormEncode;
|
||
|
|
|
||
|
|
use strict;
|
||
|
|
use Exporter;
|
||
|
|
|
||
|
|
our @ISA = qw(Exporter);
|
||
|
|
our $VERSION = '2.0.0';
|
||
|
|
|
||
|
|
our @EXPORT_OK = qw(build_urlencoded);
|
||
|
|
our @EXPORT = qw(build_urlencoded);
|
||
|
|
|
||
|
|
BEGIN {
|
||
|
|
require Plack::Request;
|
||
|
|
if ( $Plack::Request::VERSION < '1.0040' ) {
|
||
|
|
require URI::Escape;
|
||
|
|
eval <<'EOT';
|
||
|
|
sub build_urlencoded {
|
||
|
|
my(%h)=@_;
|
||
|
|
my $v;
|
||
|
|
return join('&',map {$v=URI::Escape::uri_escape($h{$_});"$_=$v"} keys %h);
|
||
|
|
}
|
||
|
|
EOT
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
require WWW::Form::UrlEncoded;
|
||
|
|
eval <<'EOT';
|
||
|
|
sub build_urlencoded {
|
||
|
|
return WWW::Form::UrlEncoded::build_urlencoded(@_);
|
||
|
|
}
|
||
|
|
EOT
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
1;
|