299 |
debug => $debug, |
debug => $debug, |
300 |
}); |
}); |
301 |
|
|
|
sub iterate_over { |
|
|
my ( $what, $error ) = @_; |
|
|
my @result; |
|
|
if ( ref( $what ) eq 'ARRAY' ) { |
|
|
@result = @{ $what }; |
|
|
} elsif ($db_config->{input}) { |
|
|
@result = ( $what ); |
|
|
} else { |
|
|
$error->() if ref($error) eq 'CODE'; |
|
|
} |
|
|
return @result; |
|
|
} |
|
302 |
|
|
303 |
# |
# |
304 |
# prepare output |
# prepare output |
305 |
# |
# |
306 |
my @outputs = iterate_over( $db_config->{output}, sub { |
my @outputs = force_array( $db_config->{output}, sub { |
307 |
$log->error("Database $database doesn't have any outputs defined. Do you want to remove it from configuration?" ); |
$log->error("Database $database doesn't have any outputs defined. Do you want to remove it from configuration?" ); |
308 |
} ); |
} ); |
309 |
|
|
334 |
# |
# |
335 |
|
|
336 |
|
|
337 |
my @inputs = iterate_over( $db_config->{input}, sub { |
my @inputs = force_array( $db_config->{input}, sub { |
338 |
$log->info("database $database doesn't have inputs defined"); |
$log->info("database $database doesn't have inputs defined"); |
339 |
} ); |
} ); |
340 |
|
|