blib/lib/String/UTF8/MD5.pm

filter: Statementstmt 83.3% 20 / 24 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 79.4% 27 / 34 CC 2 SCAR 8.1
CC
2
Cov
77%
md5
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
↑ Summary
1 package String::UTF8::MD5;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Digest::MD5;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $EXPORT_OK = qw(md5);
11  
12 =head1 NAME
13  
14 String::UTF8::MD5 - UTF-8-safe md5sums of strings
15  
16 =cut
17  
18 1 our $VERSION = '0.02';
19  
20 =head1 SYNOPSIS
21  
22 This is a simple UTF8-safe wrapper around Crypt::MD5, for use with utf-8 strings.
23  
24 use String::
25  
26 =head1 EXPORT
27  
28 =head2 md5 may be exported if requested
29  
30 =head1 SUBROUTINES/METHODS
31  
32 =head2 md5
33  
34 =cut
35  
36 0 ▶sub md5 {
Subroutine md5: not called CC=2 SCAR=17.9
Pod documented
37 0 my ($string) = @_;
38  
39 # remove utf-8 encoding
40 0 ▶ if (Encode::is_utf8($string)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Encode::is_utf8($string)) 0 0 0
41 0 $string = Encode::encode_utf8($string);
42 }
43  
44 0 return Digest::MD5::md5_hex($string);
45 }
46  
47 =head1 AUTHOR
48  
49 Binary.com, C<< <cpan at binary.com> >>
50  
51 =head1 TODO
52  
53 Only hex notation is currently supported. In the future we need to add additional
54 formatting options.
55  
56 =head1 BUGS
57  
58 Please report any bugs or feature requests to C<bug-string-utf8-md5 at rt.cpan.org>, or through
59 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-UTF8-MD5>. I will be notified, and then you'll
60 automatically be notified of progress on your bug as I make changes.
61  
62  
63  
64  
65 =head1 SUPPORT
66  
67 You can find documentation for this module with the perldoc command.
68  
69 perldoc String::UTF8::MD5
70  
71  
72 You can also look for information at:
73  
74 =over 4
75  
76 =item * RT: CPAN's request tracker (report bugs here)
77  
78 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=String-UTF8-MD5>
79  
80 =item * AnnoCPAN: Annotated CPAN documentation
81  
82 L<http://annocpan.org/dist/String-UTF8-MD5>
83  
84 =item * CPAN Ratings
85  
86 L<http://cpanratings.perl.org/d/String-UTF8-MD5>
87  
88 =item * Search CPAN
89  
90 L<http://search.cpan.org/dist/String-UTF8-MD5/>
91  
92 =back
93  
94  
95 =head1 ACKNOWLEDGEMENTS
96  
97  
98  
99 =cut
100  
101 1 1; # End of String::UTF8::MD5
↑ Summary