ma
branchfoerste
changeset 48 36aca6fb0ab8
parent 44 35441e1ae083
child 54 1f74755c407e
--- a/ma	Fri Nov 25 15:29:45 2011 +0100
+++ b/ma	Mon Nov 28 09:49:28 2011 +0100
@@ -61,7 +61,7 @@
 use FindBin;
 use Carp;
 
-use lib ("$FindBin::RealBin/..", "$FindBin::RealBin/../lib/ma");
+use lib ( "$FindBin::RealBin/..", "$FindBin::RealBin/../lib/ma" );
 use Common;
 use ldapBase;
 
@@ -71,59 +71,57 @@
 sub help();
 
 my $Module = shift if @ARGV && $ARGV[0] !~ /^-/;
-   $Module ||= "UNKNOWN";
-
+$Module ||= "UNKNOWN";
 
-$SIG{__DIE__} = sub { die "\n".ME.": ", @_ };
-
+$SIG{__DIE__} = sub { die "\n" . ME . ": ", @_ };
 
 MAIN: {
 
     $Cf = new AppConfig Common::CONFIG or die;
 
-    if (exists $ENV{MA_CONF} and -f $ENV{MA_CONF}) {
-	my $f = $ENV{MA_CONF};
-	die ": $f is group/world readable/writeable\n" if  077 & (stat _)[2];
-	$Cf->file($f) or die;
+    if ( exists $ENV{MA_CONF} and -f $ENV{MA_CONF} ) {
+        my $f = $ENV{MA_CONF};
+        die ": $f is group/world readable/writeable\n" if 077 & ( stat _ )[2];
+        $Cf->file($f) or die;
     }
-    $Cf->getopt(\@ARGV) or die "Bad Usage.  Try --help.\n";
+    $Cf->getopt( \@ARGV ) or die "Bad Usage.  Try --help.\n";
 
     die "Need ldap base.\n" if not $Cf->ldap_base;
-    if ($Cf->ldap_admin !~ /\Q$Cf->ldap_base/) {
-	$Cf->ldap_admin($Cf->ldap_admin . "," . $Cf->ldap_base);
+    if ( $Cf->ldap_admin !~ /\Q$Cf->ldap_base/ ) {
+        $Cf->ldap_admin( $Cf->ldap_admin . "," . $Cf->ldap_base );
     }
 
-    if ($Cf->help) {
-	if (-t STDOUT and -x "/usr/bin/less") { open(X, "|less -FX") }
-	else { open(X, ">&STDOUT"); }
-	print X help();
-	exit 0;
+    if ( $Cf->help ) {
+        if   ( -t STDOUT and -x "/usr/bin/less" ) { open( X, "|less -FX" ) }
+        else                                      { open( X, ">&STDOUT" ); }
+        print X help();
+        exit 0;
     }
 
     @_ = grep { $_ =~ /^\Q$Module\E/ } qw/account alias shared group/;
     die "Need module.  Try --help\n" if @_ == 0;
     die "Module ambigous. (@_)\n" if @_ > 1;
 
-    if ($_[0] eq 'account') {
-	require account;
-	account::import($Cf);
-	account::run();
-    } elsif ($_[0] eq 'alias') {
-	require alias;
-	alias::import($Cf);
-	alias::run();
-    } elsif ($_[0] eq 'shared') {
+    if ( $_[0] eq 'account' ) {
+        require account;
+        account::import($Cf);
+        account::run();
+    } elsif ( $_[0] eq 'alias' ) {
+        require alias;
+        alias::import($Cf);
+        alias::run();
+    } elsif ( $_[0] eq 'shared' ) {
         die "Command '$_[0]' is currently not supported\n";
-	require shared;
-	shared::import($Cf);
-	shared::run();
-    } elsif ($_[0] eq 'group') {
+        require shared;
+        shared::import($Cf);
+        shared::run();
+    } elsif ( $_[0] eq 'group' ) {
         die "Command '$_[0]' is currently not supported\n";
-	require group;
-	group::import($Cf);
-	group::run();
+        require group;
+        group::import($Cf);
+        group::run();
     } else {
-	die "Shit";
+        die "Shit";
     }
 
 }
@@ -133,7 +131,7 @@
 }
 
 sub help() {
-    ($_ = USAGE) =~ s/!(.*?)!/(eval $1) || ""/eg;
+    ( $_ = USAGE ) =~ s/!(.*?)!/(eval $1) || ""/eg;
     return $_;
 }