NAME
Log::Munger::RulesUsable - Checks that a rules hash is fit to run.
VERSION
Version 0.0.1
SYNOPSIS
use Log::Munger::RulesUsable;
eval { Log::Munger::RulesUsable->usable( 'rules' => $rules_hash ); };
if ($@) {
die( 'unusable rules... ' . $@ );
}
METHODS
usable
Checks that a rules hash is structurally sound enough to run against.
This says nothing about whether the rules do what they were meant to do. It only confirms that the hash is a hash, that it has a rules key, and that the key holds an array with something in it. Anything past that, such as whether the patterns compile or whether the tests pass, is Log::Munger::RulesTest's job.
The split exists because the two are used at different times. Something starting up wants a cheap look at a file it is about to load, not the full test suite.
- rules :: The rules hash ref to check. Required.
Default :: undef
Returns 1 if the hash is usable. Otherwise dies with a message naming the specific thing that was wrong, so the caller has something worth printing.
Log::Munger::RulesUsable->usable( 'rules' => $rules_hash );