Add action normalization routines

This commit is contained in:
Tom Eastep 2010-12-18 12:31:37 -08:00
parent c659f05491
commit 21166e07f3
2 changed files with 23 additions and 1 deletions

View File

@ -37,6 +37,8 @@ our @ISA = qw(Exporter);
our @EXPORT = qw(
split_action
get_target_param
normalize_action
normalize_action_name
createactionchain
%actions
%usedactions
@ -133,6 +135,26 @@ sub get_target_param( $ ) {
( $target, $param );
}
#
# Create a normalized action name from the passed pieces
#
sub normalize_action( $$ ) {
my $target = shift;
my $param = shift;
my ($action, $level, $tag ) = split /:/, $target;
$level = 'none' unless defined $level && $level ne '';
$tag = '' unless defined $tag;
$param = '' unless defined $param;
( $action, $level, $tag, $param );
}
sub normalize_action_name( $$ ) {
join (':', &normalize_action( @_ ) );
}
#
# Create and record a log action chain -- Log action chains have names
# that are formed from the action name by prepending a "%" and appending

View File

@ -86,7 +86,7 @@ sub initialize( $ ) {
}
#
# This function determines the logging for a subordinate action or a rule within a superior action
# This function determines the logging and params for a subordinate action or a rule within a superior action
#
sub merge_levels ($$) {
my ( $superior, $subordinate ) = @_;