File Coverage

blib/lib/WWW/Form/UrlEncoded.pm
Criterion Covered Total %
statement 20 24 83.3
branch 2 6 33.3
condition n/a
subroutine 4 4 100.0
pod n/a
total 26 34 76.4


line stmt bran cond sub pod time code
1             package WWW::Form::UrlEncoded;
2              
3 4     4   199026 use 5.008001;
  4         40  
4 4     4   21 use strict;
  4         8  
  4         79  
5 4     4   18 use warnings;
  4         7  
  4         799  
6              
7             BEGIN {
8 4     4   17 our $VERSION = "0.25";
9 4         14 our @EXPORT_OK = qw/parse_urlencoded parse_urlencoded_arrayref build_urlencoded build_urlencoded_utf8/;
10              
11 4         9 my $use_pp = $ENV{WWW_FORM_URLENCODED_PP};
12              
13 4 50       17 if (!$use_pp) {
14 4         8 eval {
15 4         695 require WWW::Form::UrlEncoded::XS;
16 0 0       0 if ( $WWW::Form::UrlEncoded::XS::VERSION < $VERSION ) {
17 0         0 warn "WWW::Form::UrlEncoded::XS $VERSION is require. fallback to PP version";
18 0         0 die;
19             }
20             };
21 4         21 $use_pp = !!$@;
22             }
23              
24 4 50       14 if ($use_pp) {
25 4         1965 require WWW::Form::UrlEncoded::PP;
26 4         232 WWW::Form::UrlEncoded::PP->import(@EXPORT_OK);
27             }
28             else {
29 0         0 WWW::Form::UrlEncoded::XS->import(@EXPORT_OK);
30             }
31              
32 4         46 require Exporter;
33 4         137 *import = \&Exporter::import;
34             }
35              
36             1;
37             __END__