Permalink
Browse files

[40] Moved value check of options to generic functions

Signed-off-by: DoesntMatter <jaed1@gmx.net>
  • Loading branch information...
DoesntMatter committed Jan 23, 2012
1 parent 2a05aae commit 13cfbed7acd13a29711bc5fe57dc5aab8cb4e824
Showing with 14 additions and 5 deletions.
  1. +9 −0 libs/Generic.pm
  2. +4 −4 scripts/gitlog_to_rss.pl
  3. +1 −1 scripts/gitlog_to_sql.pl
View
@@ -27,6 +27,15 @@ package Generic;
# Subroutines
#
sub HasValue {
my $var = shift || return undef;
if ($var and $var ne '') {
return 1;
}
return undef;
}
sub GetInput {
my $text = shift || return undef;
my $mandatory = shift || 0;
View
@@ -61,21 +61,21 @@
if ($options{'help'}) {
RSS::ShowHelp();
}
if ($options{'repo'} and $options{'repo'} ne '') {
if (Generic::HasValue($options{'repo'})) {
unless (Generic::CheckRepo($options{'repo'})) {
RSS::ShowHelp();
}
}
else {
RSS::ShowHelp();
}
if ($options{'title'} and $options{'title'} ne '') {
if (Generic::HasValue($options{'title'})) {
$RSS::rss{'title'} = $options{'title'};
}
if ($options{'desc'} and $options{'desc'} ne '') {
if (Generic::HasValue($options{'desc'})) {
$RSS::rss{'desc'} = $options{'desc'};
}
if ($options{'title'} and $options{'title'} ne '') {
if (Generic::HasValue($options{'title'})) {
$RSS::rss{'desc'} = $options{'desc'};
}
if ($options{'github'}) {
View
@@ -56,7 +56,7 @@
if ($options{'help'}) {
SQL::ShowHelp();
}
if ($options{'repo'} and $options{'repo'} ne '') {
if (Generic::HasValue($options{'repo'})) {
unless (Generic::CheckRepo($options{'repo'})) {
SQL::ShowHelp();
}

0 comments on commit 13cfbed

Please sign in to comment.