-
-
18 Aug 2017 22:40:38 UTC
- Distribution: URI-Encode-XS
- Module version: 0.11
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (1)
- Testers (3946 / 1 / 13)
- Kwalitee
Bus factor: 1- 100.00% Coverage
- License: freebsd
- Activity
24 month- Tools
- Download (55.57KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 2 contributors- David Farrell
- Christian Hansen
- Dependencies
- Exporter
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
URI::Encode::XS - a Perl URI encoder/decoder using C
SYNOPSIS
use URI::Encode::XS qw/uri_encode uri_encode_utf8 uri_decode uri_decode_utf8/; my $encoded = uri_encode($data); my $decoded = uri_decode($encoded); # utf8 friendly my $encoded = uri_encode_utf8($data); my $decoded = uri_decode_utf8($encoded);
DESCRIPTION
This is a Perl URI encoder/decoder written in XS based on RFC3986. This module always encodes characters that are not unreserved. When decoding, invalid escape sequences are preserved, e.g:
uri_decode("foo%20bar%a/"); # foo bar%a/ uri_decode("foo%20bar%a"); # foo bar%a uri_decode("foo%20bar%"); # foo bar%
As of version 0.10, the
bench
script shows it to be significantly faster thanURI::Escape
:Rate escape encode_utf8 encode escape 140114/s -- -94% -98% encode_utf8 2255100/s 1509% -- -71% encode 7735189/s 5421% 243% -- Rate unescape decode_utf8 decode unescape 188714/s -- -95% -97% decode_utf8 3744638/s 1884% -- -50% decode 7429263/s 3837% 98% --
However this is just one string - the fewer encoded/decoded characters are in the string, the closer the benchmark is likely to be (see
bench
for details of the benchmark). Different hardware will yield different results.Another fast encoder/decoder which supports custom escape lists, is URI::XSEscape.
INSTALLATION
$ cpan URI::Encode::XS
Or
$ git clone https://github.com/dnmfarrell/URI-Encode-XS $ cd URI-Encode-XS $ perl Makefile.PL $ make $ make test $ make install
CONTRIBUTORS
SEE ALSO
My article about the story of this module: The road to a 55x speedup with XS
REPOSITORY
https://github.com/dnmfarrell/URI-Encode-XS
LICENSE
See LICENSE
AUTHOR
© 2016 David Farrell
Module Install Instructions
To install URI::Encode::XS, copy and paste the appropriate command in to your terminal.
cpanm URI::Encode::XS
perl -MCPAN -e shell install URI::Encode::XS
For more information on module installation, please visit the detailed CPAN module installation guide.