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