aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2014-11-21 11:02:46 -0500
committerBrian Cully <bjc@kublai.com>2014-11-23 14:19:29 -0500
commitcacbab512d4102e6db19c6487c4d291006dd0fda (patch)
treebc0e623db6b94384c9305529311148712786426c /bin
downloadspamcat-cacbab512d4102e6db19c6487c4d291006dd0fda.tar.gz
spamcat-cacbab512d4102e6db19c6487c4d291006dd0fda.zip
Initial commit.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/spamcat72
1 files changed, 72 insertions, 0 deletions
diff --git a/bin/spamcat b/bin/spamcat
new file mode 100755
index 0000000..2986382
--- /dev/null
+++ b/bin/spamcat
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+spamcat - Filter spam by number of messages sent.
+
+=head1 SYNOPSIS
+
+spamcat [options]
+
+=over 8
+
+=item B<--help>
+
+Print a brief help message and exit.
+
+=item B<-c> C<file>
+
+Load configuration from C<file>
+
+=item B<--dumpconfig>
+
+Dump the current configuration.
+
+=back
+
+=head1 DESCRIPTION
+
+B<spamcat> allows you to have disposable email addresses.
+
+=head1 AUTHOR
+
+Brian Cully <bjc@kublai.com>
+
+=cut
+
+use SpamCat;
+use SpamCat::Conf;
+
+use Getopt::Long;
+use Pod::Usage;
+
+use Data::Dumper;
+
+use strict;
+use warnings;
+
+my $DEFAULT_CONFIGFILE = '/usr/local/etc/spamcat.conf';
+
+my ($help, $configfile, $dumpconfig);
+GetOptions('help|h' => \$help,
+ 'c=s' => \$configfile,
+ 'dumpconfig' => \$dumpconfig) || pod2usage(2);
+pod2usage(1) if $help;
+
+$configfile = $configfile || $DEFAULT_CONFIGFILE;
+my %conf = SpamCat::Conf::read($configfile);
+
+if ($dumpconfig) {
+ foreach my $k (keys %conf) {
+ my $v = $conf{$k};
+ if ($k eq 'domains') {
+ $v = join ', ', @{$v};
+ }
+ print uc($k) . " = " . $v . "\n";
+ }
+ exit;
+}
+
+my $sch = SpamCat->new(%conf) ||
+ die "Couldn't start spamcat: $!\n";
+$sch->deliver;