blib/lib/IO/Digest.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 96.8% 31 / 32 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package IO::Digest;
2 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use PerlIO::via::dynamic '0.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 our $VERSION = '0.11';
7  
8 =head1 NAME
9  
10 IO::Digest - Calculate digests while reading or writing
11  
12 =head1 SYNOPSIS
13  
14 use IO::Digest;
15  
16 # Get a Digest::MD5 object that takes input while $fh being written or read
17 my $fh;
18 my $iod = IO::Digest->new ($fh, 'MD5');
19  
20 print $fh "fooo";
21 print $iod->hexdigest
22  
23 =head1 DESCRIPTION
24  
25 This module allows you to calculate digests while reading or writing
26 file handles. This avoids the case you need to reread the same
27 content to compute the digests after written a file.
28  
29 =cut
30  
31 2 ▶use Digest ();
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
34 2 my $class = shift;
35 2 my $fh = shift;
36 2 my $digest = Digest->new (@_);
37 1 ▶ my $add = sub { $digest->add($_[1]) };
Subroutine __ANON__: called CC=1 SCAR=0.0
38 1 my %map = (translate => $add, untranslate => $add);
39 1 PerlIO::via::dynamic->new ( use_read => 1, %map )->via ($fh);
40 1 return $digest;
41 }
42  
43 =head1 TEST COVERAGE
44  
45 ----------------------------------- ------ ------ ------ ------ ------ ------
46 File stmt branch cond sub time total
47 ----------------------------------- ------ ------ ------ ------ ------ ------
48 blib/lib/IO/Digest.pm 100.0 n/a n/a 100.0 100.0 100.0
49 Total 100.0 n/a n/a 100.0 100.0 100.0
50 ----------------------------------- ------ ------ ------ ------ ------ ------
51  
52 =head1 AUTHORS
53  
54 Chia-liang Kao E<lt>clkao@clkao.orgE<gt>
55  
56 =head1 COPYRIGHT
57  
58 Copyright 2004 by Chia-liang Kao E<lt>clkao@clkao.orgE<gt>.
59  
60 This program is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62  
63 See L<http://www.perl.com/perl/misc/Artistic.html>
64  
65 =cut
66  
67 2 1;
↑ Summary