NAME
IOLayer::MD5 - PerlIO layer for creating an MD5 digest of a file
SYNOPSIS
use IOLayer::MD5;
IOLayer::MD5->method( 'hexdigest' ); # default, return as 32 hex digits
IOLayer::MD5->method( 'digest' ); # return as 16-byte binary value
IOLayer::MD5->method( 'b64digest' ); # return as 22-byte base64 (MIME) value
open( my $in,'<Via(IOLayer::MD5)','file' )
or die "Can't open file for digesting: $!\n";
my $digest = <$in>;
DESCRIPTION
This module implements a PerlIO layer that can only read files and return an MD5 digest of the contents of the file.
CLASS METHODS
There is one class method.
method
$method = IOLayer::MD5->method; # obtain current setting
IOLayer::MD5->method( $method ); # set new digest method
Calling this class method with a new value will cause all subsequently opened files to assume that new setting. The method however is remembered within the layer, so that it becomes part of the information that is associated with that file.
If it were possible to pass parameters such as this to the layer while opening the file, that would have been the approach taken. Since that is not possible yet, this way of doing it seems to be the next best thing.
SEE ALSO
PerlIO::Via, Digest::MD5, IOLayer::StripHTML, IOLayer::QuotedPrint, IOLayer::Base64.
COPYRIGHT
maintained by LNATION, <thisusedtobeanemail@gmail.com>
Copyright (c) 2002 Elizabeth Mattijsen.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.