Adding isa( 'IO::Seekable' ) to _isSeekable. Also seek doesn't imply tell, so added...
[archive-zip.git] / crc32
blob25bcfbd2e3127415c4763ba513958df1b40fd44b
1 #! /usr/bin/perl -w
2 # computes and prints to stdout the CRC-32 values of the given files
3 use lib qw( blib/lib lib );
4 use Archive::Zip;
5 use FileHandle;
7 my $totalFiles = scalar(@ARGV);
8 foreach my $file (@ARGV)
10 if (-d $file)
12 warn "$0: ${file}: Is a directory\n";
13 next;
15 my $fh = FileHandle->new();
16 if (! $fh->open($file, 'r'))
18 warn "$0: $!\n";
19 next;
21 binmode($fh);
22 my $buffer;
23 my $bytesRead;
24 my $crc = 0;
25 while ($bytesRead = $fh->read($buffer, 32768))
27 $crc = Archive::Zip::computeCRC32($buffer, $crc);
29 printf("%08x", $crc);
30 print("\t$file") if ($totalFiles > 1);
31 print("\n");