diff options
author | Stefan Kangas <skangas@skangas.se> | 2011-03-11 21:05:53 +0100 |
---|---|---|
committer | Stefan Kangas <skangas@skangas.se> | 2011-03-11 21:05:53 +0100 |
commit | c965c8bf6ec78123110ad0ad3ca623634f950814 (patch) | |
tree | 3a436e5d315196654aa09c658604a4730f7fe89f | |
parent | 815d0fba7abfcad9924820a35e6c3531a4fa6f70 (diff) |
Use scalar context for File::Slurp
-rwxr-xr-x | fripost-adduser | 2 | ||||
-rwxr-xr-x | fripost-newalias | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/fripost-adduser b/fripost-adduser index 86da15d..28141da 100755 --- a/fripost-adduser +++ b/fripost-adduser @@ -99,7 +99,7 @@ my $msg = MIME::Lite->new( From => 'admin@fripost.org', To => $user->{username}, Subject => 'Välkommen till Fripost!', - Data => slurp('templ/new_user_mail.tt'), # TODO: actually use TT + Data => scalar slurp('templ/new_user_mail.tt'), # TODO: actually use TT ); $msg->send(); 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, |