[EMAIL PROTECTED] wrote:
> Hello again,
> 
> I was asked to include MD5 crc checks and the quick shell I wrote to see 
> how MD5 works before dropping it in has some issues.
> i used the PPM to install all of the modules listed before writing. i KNOW 
> i have MD5 , MD5-Handle and the IO lib as well.

snip ...

> and  the script getting this  is:
> 
> #! /usr/bin/perl -w
> use strict;
> use Digest::MD5;
> use Digest::MD5::File;

Above use not needed for your test case.

> use IO::Handle;
> 
> #####
> ## md 5 test/play ground
> #####
> 
> my $md5 = Digest::Md5->new;

MD5-> rather than Md5-> ?

> my $io = new IO::Handle;
> 
> my $file = shift @ARGV;
> 
> my $fh = $io->fdopen ($file, "r");

I switched to IO::File.

> $md5->addfile($fh);
> 
> my $sum = $md5 -> digest;
> 
> print "$sum\n";

#!perl --

use strict;
use warnings;
use Digest::MD5;
use Digest::MD5::File qw(file_md5 file_md5_hex);
use IO::File;

my $file = shift @ARGV || $0;
my $fh = new IO::File $file, "r" or die "new IO::File: $! ($^E)";
binmode $fh;

my $md5 = Digest::MD5->new;
$md5->addfile($fh);
my $sum = $md5->hexdigest;
print "$file: $sum\n";

# or

$md5 = Digest::MD5->new;
$md5->addpath("./$file");
my $digest = $md5->hexdigest;
print "$file: $digest\n";

# or

$digest = file_md5_hex ($file);
print "$file: $digest\n";

__END__


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to