sources: 1-line all the "do"s for brevity and clarity

and yes, brevity and clarity "do" go together in perl :)
This commit is contained in:
Sitaram Chamarty 2009-09-01 19:36:00 +05:30
parent 62d89bf8f8
commit 5d4d5184b4
4 changed files with 6 additions and 28 deletions

View file

@ -29,14 +29,8 @@ our $REPO_BASE;
our %repos; our %repos;
my $glrc = $ENV{HOME} . "/.gitolite.rc"; my $glrc = $ENV{HOME} . "/.gitolite.rc";
unless (my $ret = do $glrc) die "parse $glrc failed: " . ($! or $@) unless do $glrc;
{ die "parse $GL_CONF_COMPILED failed: " . ($! or $@) unless do $GL_CONF_COMPILED;
die "parse $glrc failed: $@" if $@;
die "couldn't do $glrc: $!" unless defined $ret;
die "couldn't run $glrc" unless $ret;
}
die "couldnt do perms file" unless (my $ret = do $GL_CONF_COMPILED);
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# definitions specific to this program # definitions specific to this program

View file

@ -48,12 +48,7 @@ our $GL_CONF_COMPILED;
our $REPO_BASE; our $REPO_BASE;
my $glrc = $ENV{HOME} . "/.gitolite.rc"; my $glrc = $ENV{HOME} . "/.gitolite.rc";
unless (my $ret = do $glrc) die "parse $glrc failed: " . ($! or $@) unless do $glrc;
{
die "parse $glrc failed: $@" if $@;
die "couldn't do $glrc: $!" unless defined $ret;
die "couldn't run $glrc" unless $ret;
}
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# definitions specific to this program # definitions specific to this program

View file

@ -28,12 +28,7 @@ unless (-f $glrc) {
} }
# ok now $glrc exists; read it to get the other paths # ok now $glrc exists; read it to get the other paths
unless (my $ret = do $glrc) die "parse $glrc failed: " . ($! or $@) unless do $glrc;
{
die "parse $glrc failed: $@" if $@;
die "couldn't do $glrc: $!" unless defined $ret;
die "couldn't run $glrc" unless $ret;
}
# mkdir $REPO_BASE, $GL_ADMINDIR if they don't already exist # mkdir $REPO_BASE, $GL_ADMINDIR if they don't already exist
wrap_mkdir( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" ); wrap_mkdir( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );

View file

@ -31,14 +31,8 @@ our $PERSONAL;
our %repos; our %repos;
my $glrc = $ENV{HOME} . "/.gitolite.rc"; my $glrc = $ENV{HOME} . "/.gitolite.rc";
unless (my $ret = do $glrc) die "parse $glrc failed: " . ($! or $@) unless do $glrc;
{ die "parse $GL_CONF_COMPILED failed: " . ($! or $@) unless do $GL_CONF_COMPILED;
die "parse $glrc failed: $@" if $@;
die "couldn't do $glrc: $!" unless defined $ret;
die "couldn't run $glrc" unless $ret;
}
die "couldnt do perms file" unless (my $ret = do $GL_CONF_COMPILED);
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# start... # start...