I'm not familiar with `Monitoring::Plugin` but I presume if you don't use the -k argument, then this:
my $condition = $oracle_connector->opts->condition;
Returns an empty string. In that case you just need to add another condition.
my $where = "";
$where = "WHERE status = '$condition'" if $condition;
This is an atypical use of `if` (with the clauses reversed) but it works; it's the same as:
if ($condition) {
$where = "WHERE status = '$condition'"
}
Anyway, now `$where` will be empty if `$condition` is. I don't know if the blank space between `CONNECTOR.$table` and `$where` will then adversely affect your query; if so you need to put that space into the `if` block instead:
$where = " WHERE status = '$condition'"
Notice the space before the "WHERE". |