8.4 Send Mail to Developers on Deliver Operations

To improve communication among developers on your project team, you may want to create a trigger type that sends an e-mail message to team members whenever a developer completes a deliver operation. This section includes two scripts:

Setup Script

This script creates a postoperation trigger type that fires when a developer finishes a deliver operation, as represented by the deliver_complete opkind. The mktrtype command uses the -stream option to indicate that the trigger type applies only to deliver operations that target the specified integration stream.

# This is a Perl script to set up the triggertype
# for e-mail notification on deliver.
use Config;

# define platform-dependent arguments.
my $PVOBTAG;
if ($Config{'osname'} eq 'MSWin32') {
$PVOBTAG = '\cyclone_pvob';
$WCMD = '-execwin "ccperl \\\\pluto\disk1\ucmtrig_examples\ex2\ex2_postop.pl"';
}
else {
$PVOBTAG = '/pvobs/cyclone_pvob';
$WCMD = '-execwin "ccperl \\\\\\pluto\disk1\ucmtrig_examples\ex2\ex2_postop.pl"';
}
my $STREAM = "stream:P1_int\@$PVOBTAG";
my $TRTYPE = "trtype:ex2_postop\@$PVOBTAG";
my $UCMD = '-execunix "Perl /net/pluto/disk1/ucmtrig_examples/ex2/ex2_postop.pl"';

print 'cleartool mktrtype -ucmobject -all -postop deliver_complete $WCMD $UCMD -stream $STREAM -nc $TRTYPE\Q;

Postoperation Trigger Script

This postoperation trigger action fires when a developer finishes delivering work to the integration stream. The script composes and sends an e-mail message to other developers on the project team telling them that a deliver operation has just finished. The script uses ClearCase environment variables to provide the following details about the deliver operation in the body of the message: