r23583 - in /trunk/libdigest-md5-file-perl: Changes File.pm META.yml README debian/changelog t/1.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sat Jul 26 15:22:17 UTC 2008


Author: gregoa
Date: Sat Jul 26 15:22:14 2008
New Revision: 23583

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=23583
Log:
New upstream release.

Modified:
    trunk/libdigest-md5-file-perl/Changes
    trunk/libdigest-md5-file-perl/File.pm
    trunk/libdigest-md5-file-perl/META.yml
    trunk/libdigest-md5-file-perl/README
    trunk/libdigest-md5-file-perl/debian/changelog
    trunk/libdigest-md5-file-perl/t/1.t

Modified: trunk/libdigest-md5-file-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-md5-file-perl/Changes?rev=23583&op=diff
==============================================================================
--- trunk/libdigest-md5-file-perl/Changes (original)
+++ trunk/libdigest-md5-file-perl/Changes Sat Jul 26 15:22:14 2008
@@ -1,5 +1,10 @@
 Revision history for Perl extension Digest::MD5::File.
 
+0.07  Thu Jul 23 10:31:33 2008
+    - rt 34703
+    - argument logic before filehandle fetch so that they'll apply
+    - read small chunk of file handles instead if readline() to avoid various issues
+    
 0.06  Sat Nov 24 12:15:26 2007
     - rt 30618
     - rt 29653

Modified: trunk/libdigest-md5-file-perl/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-md5-file-perl/File.pm?rev=23583&op=diff
==============================================================================
--- trunk/libdigest-md5-file-perl/File.pm (original)
+++ trunk/libdigest-md5-file-perl/File.pm Sat Jul 26 15:22:14 2008
@@ -41,7 +41,7 @@
     Digest::MD5->import(keys %imp);
 }
 
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 my $getfh = sub {
     my $file = shift;
@@ -65,9 +65,9 @@
 sub Digest::MD5::adddir {
     my $md5  = shift;
     my $base = shift;
-    for( keys %{ _dir($base, undef, undef, 3) }) {
-        next if !$_;
-        my $file = File::Spec->catfile($base, $_);
+    for my $key ( keys %{ _dir($base, undef, undef, 3) }) {
+        next if !$key;
+        my $file = File::Spec->catfile($base, $key);
         $md5->addpath($file) or carp "addpath $file failed: $!" if !-d $file;
     }
     return 1;
@@ -87,7 +87,7 @@
     $_md5func    = \&file_md5_base64 if $type eq '2';   
 
     opendir(DIR, $dir) or return;
-    my @dircont = grep( $_ ne '.' && $_ ne '..', readdir(DIR));
+    my @dircont = grep { $_ ne '.' && $_ ne '..' } readdir(DIR);
     closedir DIR;
 
     for my $file( @dircont ) {
@@ -140,38 +140,43 @@
 }
 
 sub file_md5 {
-    my $fh         = $getfh->(shift()) or return; 
-    my ($bn,$ut)   = @_;
+    my ($file,$bn,$ut)   = @_;
     local $BINMODE = $bn if defined $bn;
     local $UTF8    = $ut if defined $ut;
+    my $fh         = $getfh->($file) or return;
+    
     my $md5 = Digest::MD5->new();
-    while(<$fh>) {
-	    $md5->add( $UTF8 ? Encode::encode_utf8($_) : $_ );
+    my $buf;
+    while(my $l = read($fh, $buf, 1024)) {
+	    $md5->add( $UTF8 ? Encode::encode_utf8($buf) : $buf );
     }
     return $md5->digest;
 }
 
 sub file_md5_hex {
-    my $fh         = $getfh->(shift()) or return;
-    my ($bn,$ut)   = @_;
+    my ($file,$bn,$ut)   = @_;
     local $BINMODE = $bn if defined $bn;
     local $UTF8    = $ut if defined $ut;
+    my $fh         = $getfh->($file) or return;
+    
     my $md5 = Digest::MD5->new();
-    while(<$fh>) {
-	    $md5->add( $UTF8 ? Encode::encode_utf8($_) : $_ );
+    my $buf;
+    while(my $l = read($fh, $buf, 1024)) {
+	    $md5->add( $UTF8 ? Encode::encode_utf8($buf) : $buf );
     }
     return $md5->hexdigest;
 } 
 
 sub file_md5_base64 {
-    my $fh         = $getfh->(shift()) or return;
-    my ($bn,$ut)   = @_;
+    my ($file,$bn,$ut)   = @_;
     local $BINMODE = $bn if defined $bn;
     local $UTF8    = $ut if defined $ut;
+    my $fh         = $getfh->($file) or return;
 
     my $md5 = Digest::MD5->new();
-    while(<$fh>) {
-	    $md5->add( $UTF8 ? Encode::encode_utf8($_) : $_ );
+    my $buf;
+    while(my $l = read($fh, $buf, 1024)) {
+	    $md5->add( $UTF8 ? Encode::encode_utf8($buf) : $buf );
     }
     return $md5->b64digest;
 }
@@ -206,14 +211,15 @@
     local $BINMODE   = $bn if defined $bn;
     local $UTF8      = $ut if defined $ut;
     if(ref $fl eq 'ARRAY') {
-        for(@{ $fl }) {
-            $md5->addpath($_, $bn, $ut) or return;
+        for my $pth (@{ $fl }) {
+            $md5->addpath($pth, $bn, $ut) or return;
         }
     } 
     else {
         my $fh = $getfh->($fl) or return;
-        while(<$fh>) {
-           !$UTF8 ? $md5->add($_) : $md5->add(Encode::encode_utf8($_));
+        my $buf;
+        while(my $l = read($fh, $buf, 1024)) {
+           !$UTF8 ? $md5->add($buf) : $md5->add(Encode::encode_utf8($buf));
         }
     }
     return 1;

Modified: trunk/libdigest-md5-file-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-md5-file-perl/META.yml?rev=23583&op=diff
==============================================================================
--- trunk/libdigest-md5-file-perl/META.yml (original)
+++ trunk/libdigest-md5-file-perl/META.yml Sat Jul 26 15:22:14 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.06
+version:      0.07
 version_from: File.pm
 installdirs:  site
 requires:

Modified: trunk/libdigest-md5-file-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-md5-file-perl/README?rev=23583&op=diff
==============================================================================
--- trunk/libdigest-md5-file-perl/README (original)
+++ trunk/libdigest-md5-file-perl/README Sat Jul 26 15:22:14 2008
@@ -1,4 +1,4 @@
-Digest/MD5/File version 0.06
+Digest/MD5/File version 0.07
 ============================
 
 See Pod for documentation or 

Modified: trunk/libdigest-md5-file-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-md5-file-perl/debian/changelog?rev=23583&op=diff
==============================================================================
--- trunk/libdigest-md5-file-perl/debian/changelog (original)
+++ trunk/libdigest-md5-file-perl/debian/changelog Sat Jul 26 15:22:14 2008
@@ -1,3 +1,9 @@
+libdigest-md5-file-perl (0.07-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Sat, 26 Jul 2008 17:21:30 +0200
+
 libdigest-md5-file-perl (0.06-1) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libdigest-md5-file-perl/t/1.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdigest-md5-file-perl/t/1.t?rev=23583&op=diff
==============================================================================
--- trunk/libdigest-md5-file-perl/t/1.t (original)
+++ trunk/libdigest-md5-file-perl/t/1.t Sat Jul 26 15:22:14 2008
@@ -1,9 +1,15 @@
-use Test::More tests => 3;
+use Test::More tests => 5;
 BEGIN { use_ok('Digest::MD5::File') };
 
 
 chdir 't';
-ok( Digest::MD5::File::file_md5_hex('hello-world') eq '2cad20c19a8eb9bb11a9f76527aec9bc', 'simple calc' );
+
+for(1..2) {
+   ok($_ == 1, 'pre do not clobber $_');
+   ok( Digest::MD5::File::file_md5_hex('hello-world') eq '2cad20c19a8eb9bb11a9f76527aec9bc', 'simple calc' );
+   ok($_ == 1, 'pst do not clobber $_');
+   last;
+}
 
 my $hr = Digest::MD5::File::dir_md5_hex('teststruct');
 




More information about the Pkg-perl-cvs-commits mailing list