blob: abb97cb44bf6ca46597d37d8497b84d61cfdfe1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/env perl
#-*- perl -*-
#
# Copyright (C) 2001,2002,2006 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML: md5.pl,v 1.6 2002/04/18 14:18:07 fukachan Exp $
#
use strict;
use Carp;
my $debug = defined $ENV{'debug'} ? 1 : 0;
my $file = shift || '/etc/group';
my $body = '';
use FML::Test::Utils;
my $tool = new FML::Test::Utils;
$tool->set_title("md5 checksum");
use FileHandle;
my $fh = new FileHandle $file;
while (<$fh>) { $body .= $_;}
close($fh);
use Mail::Message::Checksum;
my $p = new Mail::Message::Checksum;
my $internal = $p->md5( \$body );
my $external = program($file);
$tool->set_title("Mail::Message::Checksum::md5");
$tool->diff($internal, $external);
exit 0;
sub program
{
my ($file) = @_;
my (@x) = ();
use IO::Handle;
$fh = new IO::Handle;
open($fh, "md5 $file|");
while (<$fh>) {
chop;
(@x) = split(/\s*=\s*/);
}
close($fh);
return $x[1];
}
|