r23579 - in /branches/upstream/libdigest-md5-file-perl/current: Changes File.pm MANIFEST META.yml README t/1.t t/hello-world t/teststruct/ t/teststruct/a t/teststruct/b t/teststruct/subdir/ t/teststruct/subdir/c
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sat Jul 26 15:20:13 UTC 2008
Author: gregoa
Date: Sat Jul 26 15:20:10 2008
New Revision: 23579
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=23579
Log:
Load Digest-MD5-File-0.06/ into
branches/upstream/libdigest-md5-file-perl/current.
Added:
branches/upstream/libdigest-md5-file-perl/current/t/hello-world
branches/upstream/libdigest-md5-file-perl/current/t/teststruct/
branches/upstream/libdigest-md5-file-perl/current/t/teststruct/a
branches/upstream/libdigest-md5-file-perl/current/t/teststruct/b
branches/upstream/libdigest-md5-file-perl/current/t/teststruct/subdir/
branches/upstream/libdigest-md5-file-perl/current/t/teststruct/subdir/c
Modified:
branches/upstream/libdigest-md5-file-perl/current/Changes
branches/upstream/libdigest-md5-file-perl/current/File.pm
branches/upstream/libdigest-md5-file-perl/current/MANIFEST
branches/upstream/libdigest-md5-file-perl/current/META.yml
branches/upstream/libdigest-md5-file-perl/current/README
branches/upstream/libdigest-md5-file-perl/current/t/1.t
Modified: branches/upstream/libdigest-md5-file-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/Changes?rev=23579&op=diff
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/Changes (original)
+++ branches/upstream/libdigest-md5-file-perl/current/Changes Sat Jul 26 15:20:10 2008
@@ -1,4 +1,9 @@
Revision history for Perl extension Digest::MD5::File.
+
+0.06 Sat Nov 24 12:15:26 2007
+ - rt 30618
+ - rt 29653
+ - two more tests
0.05 Wed Jun 7 18:35:42 2006
- made it still load under perl's without Encode (older than 5.7.3) (of course Encoding doesn't work...)
Modified: branches/upstream/libdigest-md5-file-perl/current/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/File.pm?rev=23579&op=diff
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/File.pm (original)
+++ branches/upstream/libdigest-md5-file-perl/current/File.pm Sat Jul 26 15:20:10 2008
@@ -41,7 +41,7 @@
Digest::MD5->import(keys %imp);
}
-our $VERSION = '0.05';
+our $VERSION = '0.06';
my $getfh = sub {
my $file = shift;
@@ -57,15 +57,6 @@
else { return undef; }
};
-my $utf8fh = sub {
- my @utf8;
- my $fh = shift;
- for(<$fh>) {
- push @utf8, Encode::encode_utf8($_);
- }
- return @utf8;
-};
-
my $getur = sub {
my $res = LWP::UserAgent->new->get(shift());
return $res->is_success ? $res->content : undef;
@@ -103,9 +94,9 @@
my $_dirver = File::Spec->catdir($dir, $file);
my $full = -d $_dirver ? $_dirver
: File::Spec->catfile($dir, $file);
- my $short = $full;
- $short =~ s{^$base[/]?}{}; # use File::Spec instead
-
+
+ my $short = File::Spec->abs2rel( $full, $base );
+
if(-l $full) {
my $target = readlink $full;
$full = $target if -d $target;
@@ -153,8 +144,11 @@
my ($bn,$ut) = @_;
local $BINMODE = $bn if defined $bn;
local $UTF8 = $ut if defined $ut;
- return Digest::MD5::md5(<$fh>) if !$UTF8;
- return Digest::MD5::md5($utf8fh->($fh));
+ my $md5 = Digest::MD5->new();
+ while(<$fh>) {
+ $md5->add( $UTF8 ? Encode::encode_utf8($_) : $_ );
+ }
+ return $md5->digest;
}
sub file_md5_hex {
@@ -162,8 +156,11 @@
my ($bn,$ut) = @_;
local $BINMODE = $bn if defined $bn;
local $UTF8 = $ut if defined $ut;
- return Digest::MD5::md5_hex(<$fh>) if !$UTF8;
- return Digest::MD5::md5_hex($utf8fh->($fh));
+ my $md5 = Digest::MD5->new();
+ while(<$fh>) {
+ $md5->add( $UTF8 ? Encode::encode_utf8($_) : $_ );
+ }
+ return $md5->hexdigest;
}
sub file_md5_base64 {
@@ -171,8 +168,12 @@
my ($bn,$ut) = @_;
local $BINMODE = $bn if defined $bn;
local $UTF8 = $ut if defined $ut;
- return Digest::MD5::md5_base64(<$fh>) if !$UTF8;
- return Digest::MD5::md5_base64($utf8fh->($fh));
+
+ my $md5 = Digest::MD5->new();
+ while(<$fh>) {
+ $md5->add( $UTF8 ? Encode::encode_utf8($_) : $_ );
+ }
+ return $md5->b64digest;
}
sub url_md5 {
Modified: branches/upstream/libdigest-md5-file-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/MANIFEST?rev=23579&op=diff
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/MANIFEST (original)
+++ branches/upstream/libdigest-md5-file-perl/current/MANIFEST Sat Jul 26 15:20:10 2008
@@ -4,4 +4,8 @@
MANIFEST
README
t/1.t
+t/hello-world
+t/teststruct/a
+t/teststruct/b
+t/teststruct/subdir/c
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libdigest-md5-file-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/META.yml?rev=23579&op=diff
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/META.yml (original)
+++ branches/upstream/libdigest-md5-file-perl/current/META.yml Sat Jul 26 15:20:10 2008
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Digest-MD5-File
-version: 0.05
+version: 0.06
version_from: File.pm
installdirs: site
requires:
@@ -9,4 +9,4 @@
LWP::UserAgent: 0
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+generated_by: ExtUtils::MakeMaker version 6.30
Modified: branches/upstream/libdigest-md5-file-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/README?rev=23579&op=diff
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/README (original)
+++ branches/upstream/libdigest-md5-file-perl/current/README Sat Jul 26 15:20:10 2008
@@ -1,4 +1,4 @@
-Digest/MD5/File version 0.05
+Digest/MD5/File version 0.06
============================
See Pod for documentation or
Modified: branches/upstream/libdigest-md5-file-perl/current/t/1.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/t/1.t?rev=23579&op=diff
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/t/1.t (original)
+++ branches/upstream/libdigest-md5-file-perl/current/t/1.t Sat Jul 26 15:20:10 2008
@@ -1,15 +1,20 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl 1.t'
-
-#########################
-
-# change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test::More tests => 1;
+use Test::More tests => 3;
BEGIN { use_ok('Digest::MD5::File') };
-#########################
-# Insert your test code below, the Test::More module is use()ed here so read
-# its man page ( perldoc Test::More ) for help writing this test script.
+chdir 't';
+ok( Digest::MD5::File::file_md5_hex('hello-world') eq '2cad20c19a8eb9bb11a9f76527aec9bc', 'simple calc' );
+my $hr = Digest::MD5::File::dir_md5_hex('teststruct');
+
+is_deeply(
+ $hr,
+ {
+ 'a' => 'b1946ac92492d2347c6235b4d2611184',
+ 'b' => '32d6c11747e03715521007d8c84b5aff',
+ 'subdir' => '',
+ File::Spec->catfile( qw(subdir c) ) => 'df0590f214a2eaf9a638f43838132f67',
+ },
+ 'directory struct',
+);
+chdir '..';
Added: branches/upstream/libdigest-md5-file-perl/current/t/hello-world
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/t/hello-world?rev=23579&op=file
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/t/hello-world (added)
+++ branches/upstream/libdigest-md5-file-perl/current/t/hello-world Sat Jul 26 15:20:10 2008
@@ -1,0 +1,1 @@
+HELLO WORLD
Added: branches/upstream/libdigest-md5-file-perl/current/t/teststruct/a
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/t/teststruct/a?rev=23579&op=file
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/t/teststruct/a (added)
+++ branches/upstream/libdigest-md5-file-perl/current/t/teststruct/a Sat Jul 26 15:20:10 2008
@@ -1,0 +1,1 @@
+hello
Added: branches/upstream/libdigest-md5-file-perl/current/t/teststruct/b
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/t/teststruct/b?rev=23579&op=file
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/t/teststruct/b (added)
+++ branches/upstream/libdigest-md5-file-perl/current/t/teststruct/b Sat Jul 26 15:20:10 2008
@@ -1,0 +1,1 @@
+goodbye
Added: branches/upstream/libdigest-md5-file-perl/current/t/teststruct/subdir/c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdigest-md5-file-perl/current/t/teststruct/subdir/c?rev=23579&op=file
==============================================================================
--- branches/upstream/libdigest-md5-file-perl/current/t/teststruct/subdir/c (added)
+++ branches/upstream/libdigest-md5-file-perl/current/t/teststruct/subdir/c Sat Jul 26 15:20:10 2008
@@ -1,0 +1,1 @@
+howdy
More information about the Pkg-perl-cvs-commits
mailing list