[perltidy]
authorHeiko Schlittermann <hs@schlittermann.de>
Wed, 01 Jun 2016 00:54:05 +0200
changeset 63 8525154c1389
parent 62 35374fb32e6e
child 64 4a17eef44b7c
[perltidy]
bin/exigrey
lib/Exim/Grey.pm
--- a/bin/exigrey	Tue May 24 16:35:24 2016 +0200
+++ b/bin/exigrey	Wed Jun 01 00:54:05 2016 +0200
@@ -32,7 +32,7 @@
 
 use Exim::Grey qw(:all);
 
-my  $VERSION = '$Id$';
+my $VERSION = '$Id$';
 
 my $opt_list;
 my $opt_stats;
@@ -51,7 +51,7 @@
     GetOptions(
         "list!"   => \$opt_list,
         "insert!" => \$opt_insert,
-	"remove!" => \$opt_remove,
+        "remove!" => \$opt_remove,
         "stats!"  => \$opt_stats,
         "clean!"  => \$opt_clean,
         "purge!"  => \$opt_purge,
@@ -77,7 +77,7 @@
                     printf "$item: $v0 $v1 $c (%s %s)%s\n",
                       strftime("%FT%T", localtime($v0)),
                       strftime("%FT%T", localtime($v1)),
-		      $flag ? " $flag" : "";
+                      $flag ? " $flag" : "";
                 }
             );
             print "\n" if @ARGV;
@@ -97,15 +97,15 @@
                 %h,
                 sub {
                     my ($item, $v0, $v1, $c, $flags) = @_;
-		    if ($flags//'' eq 'auto') {
-			++$auto;
-			return;
-		    }
-		    ++$seen;
-		    ++$returned if $v0 != $v1;    # soon it can be $c
-		    $oldest_c = $v0 if $v0 < $oldest_c;
-		    $oldest_u = $v1 if $v1 < $oldest_u;
-		    return;
+                    if ($flags // '' eq 'auto') {
+                        ++$auto;
+                        return;
+                    }
+                    ++$seen;
+                    ++$returned if $v0 != $v1;    # soon it can be $c
+                    $oldest_c = $v0 if $v0 < $oldest_c;
+                    $oldest_u = $v1 if $v1 < $oldest_u;
+                    return;
                 }
             );
 
@@ -120,10 +120,12 @@
     oldest (used): %.1f days (%s)
 __
             printf $_, scalar(localtime), (-s $db) / (1024 * 1024),
-              ((stat $db)[12] * 512) / (1024 * 1024), 
-              length($seen), $returned,	int(0.5 + 100 * ($returned / $seen)),                 # returned
-              length($seen), $seen - $returned, int(0.5 + 100 * ($seen - $returned) / $seen), # not returned
-	      length($seen), $auto,							      # auto white
+              ((stat $db)[12] * 512) / (1024 * 1024),
+              length($seen), $returned,
+              int(0.5 + 100 * ($returned / $seen)),    # returned
+              length($seen), $seen - $returned,
+              int(0.5 + 100 * ($seen - $returned) / $seen),    # not returned
+              length($seen), $auto,                            # auto white
               ((time - $oldest_c) / 86400), scalar(localtime $oldest_c),
               ((time - $oldest_u) / 86400), scalar(localtime $oldest_u);
             print "\n" if @ARGV;
@@ -134,7 +136,7 @@
 
     if ($opt_clean or $opt_purge) {
 
-        my $cut = time() - (86400 * (@ARGV ? shift: 7));
+        my $cut = time() - (86400 * (@ARGV ? shift : 7));
         foreach (getDBs(@ARGV)) {
             my %h;
             my $tmp = tmpfile();
@@ -171,23 +173,23 @@
     }
 
     if ($opt_remove) {
-	my %default = getDefault();
-	my $item = shift;
-	my $db = shift // $default{db};
-
-	my $key = "$item\0";
+        my %default = getDefault();
+        my $item    = shift;
+        my $db      = shift // $default{db};
 
-	connectDB(\my %h, $db);
-	if (not exists $h{$key}) {
-	    warn "$0: key `$key' not found\n";
-	}
-	else {
-	    $_ = $h{$key};	# delete from tied hashes
-	    delete $h{$key};	# doesn't return anything always
-	    chop;
-	    print "$key: $_\n";
-	}
-	exit 0;
+        my $key = "$item\0";
+
+        connectDB(\my %h, $db);
+        if (not exists $h{$key}) {
+            warn "$0: key `$key' not found\n";
+        }
+        else {
+            $_ = $h{$key};      # delete from tied hashes
+            delete $h{$key};    # doesn't return anything always
+            chop;
+            print "$key: $_\n";
+        }
+        exit 0;
     }
 }
 
@@ -204,7 +206,7 @@
         chop($k, $v);
 ### $k
 ### $v
-        &$sub($k, (split(' ', $v), 0, 0)[ 0 .. 3 ]);    # 0 for filling
+        &$sub($k, (split(' ', $v), 0, 0)[0 .. 3]);    # 0 for filling
     }
 }
 
--- a/lib/Exim/Grey.pm	Tue May 24 16:35:24 2016 +0200
+++ b/lib/Exim/Grey.pm	Wed Jun 01 00:54:05 2016 +0200
@@ -5,11 +5,9 @@
 use base 'Exporter';
 use Carp;
 
-our @EXPORT_OK = qw(unseen getDBDir connectDB getDefault);
-our %EXPORT_TAGS = (
-    all => \@EXPORT_OK,
-);
-our $VERSION = '2.0';
+our @EXPORT_OK   = qw(unseen getDBDir connectDB getDefault);
+our %EXPORT_TAGS = (all => \@EXPORT_OK,);
+our $VERSION     = '2.0';
 
 # You may choose, but DB_File's footprint is smaller.
 # perl -MDB_File -e 'tie %h, ...':	real    0m0.063s