| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Any::URI::Escape; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 23711 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 42 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 50 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = 0.01; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | =head1 NAME | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | Any::URI::Escape - Load URI::Escape::XS preferentially over URI::Escape | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | =cut | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 1 |  |  | 1 |  | 6 | use base 'Exporter'; | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 189 |  | 
| 15 |  |  |  |  |  |  | our @EXPORT = qw( uri_escape uri_unescape ); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | BEGIN { | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 1 |  |  | 1 |  | 61 | eval 'require URI::Escape::XS'; | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 1 |  |  |  |  | 4 | my $pkg; | 
| 22 | 1 | 50 |  |  |  | 4 | if ($@) { | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | # xs version not installed, use URI::Escape | 
| 25 | 1 |  |  |  |  | 860 | require URI::Escape; | 
| 26 | 1 |  |  |  |  | 1459 | $pkg = 'URI::Escape'; | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  | else { | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 0 |  |  |  |  | 0 | $pkg = 'URI::Escape::XS'; | 
| 32 |  |  |  |  |  |  | } | 
| 33 | 1 |  |  | 1 |  | 6 | no strict 'refs'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 76 |  | 
| 34 | 1 |  |  |  |  | 1 | my $class = __PACKAGE__; | 
| 35 | 1 |  |  |  |  | 2 | *{"$class\::uri_escape"} = *{"$pkg\::uri_escape"}; | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 3 |  | 
| 36 | 1 |  |  |  |  | 2 | *{"$class\::uri_unescape"} = *{"$pkg\::uri_unescape"}; | 
|  | 1 |  |  |  |  | 46 |  | 
|  | 1 |  |  |  |  | 39 |  | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | use Any::URI::Escape; | 
| 45 |  |  |  |  |  |  | $escaped_url = uri_escape($url); | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | # URI::Escape::XS will be used instead of URI::Escape if it is installed. | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | URI::Escape is great, but URI::Escape::XS is faster.  This module loads | 
| 52 |  |  |  |  |  |  | URI::Escape::XS and imports the two most common methods if XS is installed. | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | The insides of this module aren't completely shaken out yet, so patches | 
| 55 |  |  |  |  |  |  | welcome. | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | L | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | L | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =head1 AUTHOR | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | Fred Moyer, Efred@redhotpenguin.comE | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | Copyright (C) 2010 by Fred Moyer | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 72 |  |  |  |  |  |  | it under the same terms as Perl itself, either Perl version 5.12.0 or, | 
| 73 |  |  |  |  |  |  | at your option, any later version of Perl 5 you may have available. | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =cut |