NAME
Schedule::Activity::Message - Container for individual or multiple messages
SYNOPSIS
my $message=Schedule::Activity::Message->new(
message =>'key name',
message =>'string message',
message =>['array', 'of', 'alternates'],
message =>{name=>key},
message =>{
alternates=>[
{message=>'string', attributes=>{...}},
{name=>key},
...
],
},
names=>{
key=>{
message=>'string message',
attributes=>{...} # optional
},
},
attributes=>{...} # optional
note =>... # optional
);
FUNCTIONS
random
Retrieve a pair of (message,object)
, which is either an individual string message, or a random selection from an array or hash of alternatives. The first index will always be a string, possibly empty. The object can be used to inspect message attributes.
attributesFromConf
Given a plain (unknown) message configuration, find any embedded attributes. This function is primarily useful during schedule configuration validation, prior to full action nodes being built, to identify all attributes within a nested configuration. It does not need to handle named attributes because those are separately declared.
NAMED MESSAGES
Named messages permit sharing of common messages across configured instances. This is particularly useful when there are a large number of common alternate messages where copy/pasting through the scheduling configuration would be egregious.
A reference may be provided to names
, each defined with a lookup key
and containing a plain message string and, optionally, attributes. During message selection, any string message or configured name
will return the message configuration for key=name
, if it exists, or will return the string message. This applies to all messages configurations (flat strings, array of strings, hash containing a message
, and hash containing a name
). If a configured message matches a referenced name, the name takes precedence.
As of version 0.1.2, there is very little validation of the names
contents.