1 package Debbugs::Email;
7 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
9 # set the version for version checking
14 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
16 # your exported package globals go here,
17 # as well as any optionally exported functions
22 use Debbugs::Config qw(%Globals);
24 # initialize package globals, first exported ones
25 %gtags= ( "SECRETARY_TITLE" => "Debian Project Secretary",
26 "SECRETARY_NAME" => "Darren Benham",
27 "ERRORS_TITLE" => "Nobody",
28 "ERRORS_EMAIL" => "errors\@benham.net",
29 "VOTE_TITLE" => "Set Vote Title",
30 "SECRETARY_EMAIL" => "secretary\@debian.org");
32 #############################################################################
33 # Initialize Global Tags
34 #############################################################################
38 print "V: Initializing Email Tags\n" if $Globals{ 'verbose' };
39 for( my $i=0; $i<=$#config; $i++)
42 next unless length $_;
44 if ( /^GTAG\s*[:=]\s*(\S)+\s*[:=]\s*([^#]*)/i )
46 print "D2: (email) GTag $1=$gtags{$1}\n" if $Globals{ 'debug' } > 1;
51 #############################################################################
53 #############################################################################
55 { my $emailfile = $_[0];
58 open( LETTER, $emailfile ) or &::fail( "Unable to open $emailfile: $!" );
61 &ProcessTags( \@email, \%gtags, "GTAG" );
64 #############################################################################
66 #############################################################################
68 { my ($email, $tagsin, $marker) = @_;
72 print "V: Processing Template Mail\n" if $Globals{ 'verbose' };
73 foreach my $line ( @$email )
74 { while( $line =~ /\%$marker\_(\S*)\%/s )
75 { if( defined( $tags{ $1 } ) ) { $tag = $tags{ $1 }; }
76 else { $tag = "(missed tag $1)"; }
77 $line =~ s/\%$marker\_(\S*)\%/$tag/;
83 END { } # module clean-up code here (global destructor)