Notify |
![]() |
Notify - notify users of system changes
Ian Malpass <ian@aptest.com>
Copyright 2001-2006 Applied Testing and Technology, Inc. All Rights Reserved.
use Notify;
# get a hash of testChange trigger information
$testCreate = Notify->triggers( trigger => "testChange" );
# get a hash of only Edit triggers
%triggers = Notify->triggers( category => "Edit" );
# get a hash of all triggers
%triggers = Notify->triggers();
# check a trigger;
my $valid = Notify->validTrigger( "testCreate" );
# send notifcation mail
Notify->notify(
suite => $suite,
trigger => "testChange",
message => "$user created $test",
);
$notificationTriggers{ 'aTrigger' } = {
title => 'Bing',
note => 'The machine goes "bing"',
subject => 'The machine went "bing"',
category => 'System administration',
perSuite => 0,
};
Each trigger is a hash of five keys:
%widetTrigger = Notify->triggers( trigger => 'testChange' );
%editTriggers = Notify->triggers( category => 'Edit' );
%triggers = Notify->triggers();
If you specify a trigger, triggers() will return a hash of information about that trigger.
If you specify a category, triggers() will return a hash of hashes of information about triggers in that category.
If you give no argument, triggers() will return a hash of hashes of information about all triggers.
%triggerCats = Notify->triggersInCategories( perSuite => $perSuite );
If the optional perSuite argument is sent, then only triggers (and categories) that match the argument's value (0 for global notifications, 1 for suite notifications) will be returned.
if ( Notify->validTrigger( $trigger ) {
...
}
# send to any user subscribed to testChange
Notify->notify(
suite => $suite,
trigger => "testChange",
message => "$user created $test",
);
# send to only Alice and Bob, if they're subscribed to testChange
Notify->notify(
suite => $suite,
trigger => "testChange",
message => "$user created $test",
userList => [ "Alice", "Bob" ],
);
# send mail to any user subscribed to testChange except Eve
Notify->notify(
suite => $suite,
trigger => "testChange",
message => "$user created $test",
noMail => [ "Eve" ],
);
The trigger and message arguments are required.
If suite is omitted, it is assumed that the trigger is a global one.
The userList and noMail arguments are optional (and typically mututally exclusive) and must be array refs.
If you specify a subject argument, it gets used instead of the default subject.
Copyright © 2000-2006 Applied Testing and Technology, Inc. All rights reserved.