| IO-Digest documentation | Contained in the IO-Digest distribution. |
IO::Digest - Calculate digests while reading or writing
use IO::Digest; # Get a Digest::MD5 object that takes input while $fh being written or read $iod = IO::Digest->new ($fh, 'MD5'); print $fh "fooo"; print $iod->hexdigest
This module allows you to calculate digests while reading or writing file handles. This avoids the case you need to reread the same content to compute the digests after written a file.
----------------------------------- ------ ------ ------ ------ ------ ------ File stmt branch cond sub time total ----------------------------------- ------ ------ ------ ------ ------ ------ blib/lib/IO/Digest.pm 100.0 n/a n/a 100.0 100.0 100.0 Total 100.0 n/a n/a 100.0 100.0 100.0 ----------------------------------- ------ ------ ------ ------ ------ ------
Chia-liang Kao <clkao@clkao.org>
Copyright 2004 by Chia-liang Kao <clkao@clkao.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| IO-Digest documentation | Contained in the IO-Digest distribution. |
package IO::Digest; use 5.008; use strict; use warnings; use PerlIO::via::dynamic '0.10'; our $VERSION = '0.10';
use Digest (); sub new { my $class = shift; my $fh = shift; my $digest = Digest->new (@_); my $add = sub { $digest->add($_[1]) }; my %map = (translate => $add, untranslate => $add); PerlIO::via::dynamic->new ( use_read => 1, %map )->via ($fh); return $digest; }
1;