aboutsummaryrefslogtreecommitdiffstats
path: root/fripost-newalias
diff options
context:
space:
mode:
authorStefan Kangas <skangas@skangas.se>2011-03-11 21:05:53 +0100
committerStefan Kangas <skangas@skangas.se>2011-03-11 21:05:53 +0100
commitc965c8bf6ec78123110ad0ad3ca623634f950814 (patch)
tree3a436e5d315196654aa09c658604a4730f7fe89f /fripost-newalias
parent815d0fba7abfcad9924820a35e6c3531a4fa6f70 (diff)
Use scalar context for File::Slurp
Diffstat (limited to 'fripost-newalias')
-rwxr-xr-xfripost-newalias8
1 files changed, 6 insertions, 2 deletions
diff --git a/fripost-newalias b/fripost-newalias
index fb50a0c..53dd3e4 100755
--- a/fripost-newalias
+++ b/fripost-newalias
@@ -21,6 +21,7 @@ use FindBin qw($Bin);
use lib "$Bin/lib";
use Data::Dumper;
+use Email::Valid;
use Fripost::Password;
use Fripost::Prompt;
use Fripost::Schema;
@@ -43,11 +44,10 @@ my $schema = Fripost::Schema->connect(
$conf->{dbi_dsn}, $conf->{admuser}, $conf->{admpass}, {} #\%dbi_params
);
+# Get information
my $goto = shift @ARGV;
my @addr = @ARGV;
-
$goto //= prompt_username("Alias goto address: ");
-
@addr || push @addr, prompt "Alias address: ";
if ($conf->{pretend}) {
@@ -61,6 +61,10 @@ for my $addr (@addr) {
address => $addr,
});
if (!$rs->count) {
+ unless (Email::Valid->address($addr)) {
+ say "WARN: skipping invalid address $addr";
+ next;
+ }
my $db_alias = $schema->resultset('Alias')->new({
address => $addr,
goto => $goto,