diff options
author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-06-05 09:49:33 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-06-05 09:49:33 +0200 |
commit | ccc5ce7bf9abe341119acb0aa4a8a138add41dc7 (patch) | |
tree | 0e3e49802bc977ee0c2fe08afed4f3a009d485b7 /lib/Fripost/Commands/alias_search.pm | |
parent | f779c5034227750e7a500f79890dafd81b2a98bf (diff) |
Changing the command names to something more intuitive (hopefully).
Diffstat (limited to 'lib/Fripost/Commands/alias_search.pm')
-rw-r--r-- | lib/Fripost/Commands/alias_search.pm | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/lib/Fripost/Commands/alias_search.pm b/lib/Fripost/Commands/alias_search.pm deleted file mode 100644 index 6e638ac..0000000 --- a/lib/Fripost/Commands/alias_search.pm +++ /dev/null @@ -1,80 +0,0 @@ -package Fripost::Commands::alias_search; - -use 5.010_000; -use strict; -use warnings; -use utf8; - -=head1 NAME - -alias_search.pm - List matching virtual aliases - -=cut - -use FindBin qw($Bin); -use lib "$Bin/lib"; - -use Fripost::Schema; - -our $VERSION = '0.01'; - -sub perform_search { - my $ldap = shift; - - foreach my $alias ($ldap->alias->search( $_[0] )->entries) { - say "" . ($alias->{isActive} ? "ACTIVE" : "INACTIVE") - . " alias for " . $alias->{goto} . " are " - . (join ', ', @{$alias->{address}}); - } -} - -sub main { - my $ldap = shift; - my $conf = shift; - - my $search = $_[0]; - - my $f = $conf->{from}; - my $g = $conf->{goto}; - my $from = $f || !$f && !$g; - my $goto = $g || !$f && !$g; - - if ($from) { - perform_search($ldap, {address => $search}); - - my ($u,$d) = split /\@/, $search, 2; - $d = $u if (defined $u) and not (defined $d); - $ldap->domain->search({ domain => $d })->count - or die "Error: Unknown domain `$d'.\n"; - } - - if ($goto) { - perform_search($ldap, {goto => $search}); - } -} - - -=head1 AUTHOR - -Guilhem Moulin C<< <guilhem at fripost.org> >> - -=head1 COPYRIGHT - -Copyright 2012 Guilhem Moulin. - -Copyright 2012 Stefan Kangas <skangas@skangas.se>. - -=head1 LICENSE - -This program is free software; you can redistribute it and/or modify it -under the same terms as perl itself. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -=cut - -1; # End of alias_search.pm - -__END__ |