[Mimedefang] Boilerplate message

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Mon Sep 20 17:40:52 EDT 2004


Matthew.van.Eerde wrote:
> Johann wrote:
>> append_text_boilerplate($entity, "Scanned for viruses, trojans and
>> worms. Verified clean by Sophos Antivirus" . "/n Legal mumbo-jumbo
>> here.", 0);
> 
> Do this (a "here document"):
> 
> my $boilerplate = <<END_OF_BOILERPLATE;
> Scanned for viruses, trojans and worms. Verified clean by
> Sophos Antivirus.
> 
> legalese goes here.
> Make sure to escape dollar signs with backslashs like this:
> If you do anything wrong we'll sue you for \$1,000,000.
> Thanks so much.
> END_OF_BOILERPLATE
> 
> append_text_boilerplate($entity, $boilerplate, 0);

Or if you want to be superflexible you could store the legalese externally to the perl script.  Then you could give the legal department a means of updating the file should they want to change the text, without giving the chance to break the perl.
If you do it this way you don't need to escape dollar signs or anything.

1) Globally at the top-ish:

my $boilerplate = "";
my $path_to_boilerplate = "/put/your/global/boilerplate/path/here";
sub load_boilerplate();

2) within filter_end:
sub filter_end
{ ...
	append_text_boilerplate($entity, load_boilerplate(), 0);
}

3) At the end-ish...
sub load_boilerplate()
{	return $boilerplate if $boilerplate; # cache per-slave

	open(BOILERPLATE, $path_to_boilerplate) or
		die("Could not open $path_to_boilerplate");
	$boilerplate = join("", <BOILERPLATE>);
	close(BOILERPLATE);

	return $boilerplate;
}

Matthew.van.Eerde at hbinc.com                      805.964.4554 x902
Hispanic Business Inc./HireDiversity.com         Software Engineer
perl -e"map{y/a-z/l-za-k/;print}shift" "Jjhi pcdiwtg Ptga wprztg,"



More information about the MIMEDefang mailing list