1 |
#!/usr/bin/perl |
2 |
|
3 |
# ============================================================ |
4 |
# |
5 |
# dispatchmail v0.05 |
6 |
# A simple mail filter done in perl |
7 |
# with the Perl-module "Mail::Audit" |
8 |
# available from CPAN. |
9 |
# |
10 |
# $Id: dispatchmail,v 1.4 2003/01/22 17:50:56 root Exp $ |
11 |
# |
12 |
# ============================================================ |
13 |
# $Log: dispatchmail,v $ |
14 |
# Revision 1.4 2003/01/22 17:50:56 root |
15 |
# - refactored most code to Mail::Audit::Dispath |
16 |
# |
17 |
# Revision 1.3 2003/01/22 07:16:51 root |
18 |
# + sub traceEntry |
19 |
# + further refactorings |
20 |
# |
21 |
# Revision 1.2 2003/01/22 05:38:44 collector |
22 |
# + prepared refactoring to 'dispatchmail' |
23 |
# |
24 |
# ============================================================ |
25 |
|
26 |
use strict; |
27 |
# don't use warnings; |
28 |
|
29 |
use Data::Dumper; |
30 |
use Getopt::Long; |
31 |
use Hash::Merge qw( merge ); |
32 |
|
33 |
use lib qw( /data/libs/nfo/perl/libs ); |
34 |
use Mail::Audit::Dispatch; |
35 |
|
36 |
|
37 |
# - - - - - - - - - - - - - - - - - - - - |
38 |
# options |
39 |
# - - - - - - - - - - - - - - - - - - - - |
40 |
|
41 |
my $defaults = { |
42 |
LOG => 1, # writes reports to logfile |
43 |
VERBOSE => 1, # writes reports to STDOUT |
44 |
TRACE => 1, # writes contents of messages to logfile |
45 |
}; |
46 |
|
47 |
my $args; |
48 |
GetOptions( |
49 |
'user=s' => \$args->{user}, |
50 |
'base=s' => \$args->{base}, |
51 |
'rules=s' => \$args->{rules}, |
52 |
'mode=s' => \$args->{mode}, |
53 |
'newsgroup=s' => \$args->{newsgroup}, |
54 |
); |
55 |
|
56 |
my $args_dispatch = merge($defaults, $args); |
57 |
|
58 |
#print Dumper($args_dispatch); |
59 |
#exit; |
60 |
|
61 |
my @args_array = %$args_dispatch; |
62 |
my $dispatcher = Mail::Audit::Dispatch->new(@args_array); |
63 |
$dispatcher->run(); |
64 |
|
65 |
1; |