projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git+ssh://github.com/adefaria/clearscm
[clearscm.git]
/
maps
/
bin
/
add2nulllist.pl
diff --git
a/maps/bin/add2nulllist.pl
b/maps/bin/add2nulllist.pl
index
27d694e
..
8ae2c78
100755
(executable)
--- a/
maps/bin/add2nulllist.pl
+++ b/
maps/bin/add2nulllist.pl
@@
-4,7
+4,7
@@
use warnings;
use FindBin;
use FindBin;
-use lib
$FindBin::Bin
, '/opt/clearscm/lib';
+use lib
"$FindBin::Bin/../lib"
, '/opt/clearscm/lib';
use MAPS;
use MAPSLog;
use MAPS;
use MAPSLog;
@@
-16,38
+16,40
@@
my $userid = $ENV{USER};
my $Userid;
my $type = "null";
my $Userid;
my $type = "null";
-sub GetItems {
- my
$filename = shift
;
+sub GetItems
($)
{
+ my
($filename) = @_
;
my @items;
my @items;
- open
FILE
, $filename
+ open
my $file, '<'
, $filename
or error "Unable to open $filename - $!", 1;
or error "Unable to open $filename - $!", 1;
- while (<
FILE
>) {
+ while (<
$file
>) {
my @fields = split;
my %item;
my @fields = split;
my %item;
- my @address = split /\@/, $fields
[0];
+ my @address = split /\@/, $fields[0];
$item{pattern} = $address[0];
$item{domain} = $address[1];
$item{comment} = $fields[1] ? $fields[1] : '';
$item{pattern} = $address[0];
$item{domain} = $address[1];
$item{comment} = $fields[1] ? $fields[1] : '';
- $it
me
{hit_count} = $fields[2] ? $fields[2] : 0;
+ $it
em
{hit_count} = $fields[2] ? $fields[2] : 0;
push @items, \%item;
} # while
push @items, \%item;
} # while
+ close $file;
+
return @items;
} # GetItems
return @items;
} # GetItems
-sub Add2List {
+sub Add2List
(@)
{
my @items = @_;
my @items = @_;
- my $sender =
""
;
- my $nextseq =
MAPSDB::GetNextSequenceNo $userid, $type
;
+ my $sender =
''
;
+ my $nextseq =
GetNextSequenceNo($userid, $type)
;
- for
each
(@items) {
+ for (@items) {
my %item = %{$_};
my $pattern = $item{pattern};
my %item = %{$_};
my $pattern = $item{pattern};
@@
-62,41
+64,44
@@
sub Add2List {
$sender = lc ("$pattern\@$domain");
$sender = lc ("$pattern\@$domain");
- if (OnNulllist
$sender
) {
- display
" Already on list"
;
+ if (OnNulllist
($sender)
) {
+ display
' Already on list'
;
} else {
} else {
- Add2Nulllist
$sender, $userid, $comment, $hit_count
;
- display
" done"
;
+ Add2Nulllist
($sender, $userid, $comment, $hit_count)
;
+ display
' done'
;
# Now remove this entry from the other lists (if present)
# Now remove this entry from the other lists (if present)
- for
each my $otherlist ("white", "black"
) {
- my $sth = FindList
$otherlist, $sender
;
+ for
my $otherlist ('white', 'black'
) {
+ my $sth = FindList
($otherlist, $sender)
;
my ($sequence, $count);
my ($sequence, $count);
- ($_, $_, $_, $_, $_, $sequence) = GetList
$sth
;
+ ($_, $_, $_, $_, $_, $sequence) = GetList
($sth)
;
if ($sequence) {
if ($sequence) {
- $count = DeleteList
$otherlist, $sequence
;
+ $count = DeleteList
($otherlist, $sequence)
;
} # if
} # if
- } # for
each
+ } # for
} # if
} # if
+
$nextseq++;
} # while
$nextseq++;
} # while
+
+ return;
} # Add2List
# Main
my $filename;
} # Add2List
# Main
my $filename;
-if ($ARGV
[0]) {
+if ($ARGV[0]) {
$filename = $ARGV[0];
} else {
error "Must specify a filename of addresses to null list", 1;
} # if
$filename = $ARGV[0];
} else {
error "Must specify a filename of addresses to null list", 1;
} # if
-SetContext
$userid
;
+SetContext
($userid)
;
$Userid = ucfirst $userid;
$Userid = ucfirst $userid;
-Add2List
(GetItems $filename
);
+Add2List
(GetItems ($filename)
);
exit;
exit;