blib/lib/Siesta/Plugin/MessageFooter.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 100% 40 / 40 CC 2 SCAR 2.0
CC
2
Cov
100%
process
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Siesta/Plugin/Archive.pm ↑ Summary blib/lib/Siesta/Web.pm »
1 package Siesta::Plugin::MessageFooter;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use Siesta::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use base 'Siesta::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Siesta;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Sys::Hostname;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 1 ▶sub description {
Subroutine description: called CC=1 SCAR=0.0
Pod documented
11 1 'Add a message footer';
12 }
13  
14  
15  
16 4 ▶sub process {
Subroutine process: called CC=2 SCAR=6.9
Pod documented
17 4 my $self = shift;
18 4 my $mail = shift;
19 4 my $list = $self->list;
20  
21 # get the raw footer or return
22 4 ▶ my $rawfooter = $self->pref('footer') || return 0;
Condition100%2/2
$self->pref('footer') || (return 0)
l!l
31
MC/DC100%1/1
$self->pref('footer') || (return 0)
$self->pref('footer')
Truth table100%2/2
A
A= $self->pref('footer')
Aresult
11
00
23  
24  
25 # from
26 # http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mailman/mailman/Mailman/Handlers/Decorate.py
27 3 my %vars = ( 'real_name' => $list->name,
28 'list_name' => $list->name,
29 # For backwards compatibility
30 '_internal_name' => $list->name,
31 'host_name' => $self->pref('host_name'),
32 'web_page_url' => $self->pref('web_page_url'),
33 'description' => $self->pref('description'),
34 'info' => $self->pref('info'),
35 'cgiext' => $self->pref('cgiext'),
36 'list' => $list,
37  
38 );
39
40  
41 # bake it
42 3 my $footer = Siesta->bake(\$rawfooter, %vars);
43
44 # and add it to the end of the mail
45 3 $mail->body_set($mail->body()."\n$footer");
46  
47 # and bug out
48 3 return 0;
49 }
50  
51 22 ▶sub options {
Subroutine options: called CC=1 SCAR=0.0
Pod documented
52 +{
53 22 'footer'
54 => {
55 'description' =>
56 'a footer to add to the end of every mail. See Siesta::Plugin::MessageFooter for more details',
57 'type' => 'text',
58 'default' => '',
59 'widget' => 'textbox',
60 },
61 'host_name'
62 => {
63 'description' =>
64 'the hostname (default is the hostname worked out by Sys::Hostname)',
65 'type' => 'text',
66 'default' => hostname,
67 'widget' => 'textbox',
68 },
69 'web_page_url'
70 => {
71 'description' =>
72 'the url of of the list web page',
73 'type' => 'text',
74 'default' => '',
75 'widget' => 'textbox',
76 },
77 'cgiext'
78 => {
79 'description' =>
80 'cgi extension',
81 'type' => 'text',
82 'default' => '',
83 'widget' => 'textbox',
84 },
85  
86 'description'
87 => {
88 'description' =>
89 'a short description of the list',
90 'type' => 'text',
91 'default' => '',
92 'widget' => 'textbox',
93 },
94 'info'
95 => {
96 'description' =>
97 'a longer description of the list',
98 'type' => 'text',
99 'default' => '',
100 'widget' => 'textbox',
101 },
102 };
103 }
104  
105 4 1;
106  
107 =pod
108
109 =head1 NAME
110  
111 Siesta::Plugin::MessageFooter - add a configurable footer to the end of every mail.
112
113 =head1 SYNOPSIS
114
115 The [% real_name %] list :
116 Web [% web_page_url %]
117 Owner [% list.owner.email %]
118
119 =head1 DESCRIPTION
120  
121 This allows you to put configurable footers at the end of every mail.
122  
123 The variables passed to the I<Template::Toolkit> style footer are listed below.
124  
125 Most are provided for Mailman backwards compatability.
126  
127 =over 4
128  
129 =item real_name
130  
131 The name of the list
132  
133 =item list_name
134  
135 ditto
136  
137 =item _internal_name
138  
139 erm, ditto again
140  
141 =item host_name
142  
143 The 'host_name' preference or the system's hostname as worked out
144 by I<Sys::Hostname>.
145  
146 The hostname preference can be set using the web interface or by using
147  
148 % nacho modify-plugin MessageFooter <list name> host_name <insert your hostname here>
149  
150 =item web_page_url
151  
152 The 'web_page_url' preference.
153  
154 =item description
155  
156 The 'description' preference.
157  
158 =item list
159  
160 A copy of the list object that this plugin is being called from.
161  
162 =back
163
164 =head1 COPYRIGHT
165
166 (c)opyright 2003 - The Siesta Dev Team
167
168 =cut
169  
« blib/lib/Siesta/Plugin/Archive.pm ↑ Summary blib/lib/Siesta/Web.pm »