| 1 | package Mail::LMLM; | ||||||||||||||||||||||||||||||
| 2 | 2 | $Mail::LMLM::VERSION = '0.6805'; | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use 5.008; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Mail::LMLM::Object; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||
| 12 | 2 | @ISA=qw(Mail::LMLM::Object); | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Mail::LMLM::Render::HTML; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Mail::LMLM::Types::Ezmlm; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Mail::LMLM::Types::Egroups; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use Mail::LMLM::Types::Listar; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use Mail::LMLM::Types::Majordomo; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use Mail::LMLM::Types::Listserv; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Mail::LMLM::Types::Mailman; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use Mail::LMLM::Types::GoogleGroups; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | use vars qw(%mailing_list_classes); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||
| 26 | 2 | my $prefix = "Mail::LMLM::Types::"; | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||
| 28 | sub _pref | ||||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||||
| 30 | 14 | ▶ | my $name = shift; | ||||||||||||||||||||||||||||
|
Subroutine
_pref: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||
| 32 | 14 | return $prefix . $name; | |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||
| 35 | %mailing_list_classes = | ||||||||||||||||||||||||||||||
| 36 | ( | ||||||||||||||||||||||||||||||
| 37 | ( | ||||||||||||||||||||||||||||||
| 38 | 2 | map { $_ => _pref(ucfirst($_)) } | |||||||||||||||||||||||||||||
| 39 | ('egroups', 'ezmlm', 'listar', 'majordomo', 'listserv', 'mailman') | ||||||||||||||||||||||||||||||
| 40 | ), | ||||||||||||||||||||||||||||||
| 41 | "google" => _pref("GoogleGroups"), | ||||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||
| 44 | 2 | ▶ | use vars qw(@render_what); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||
| 46 | 2 | @render_what = | |||||||||||||||||||||||||||||
| 47 | ( | ||||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||||
| 49 | 'title' => "Description", | ||||||||||||||||||||||||||||||
| 50 | 'func' => "render_description", | ||||||||||||||||||||||||||||||
| 51 | 'id' => "desc", | ||||||||||||||||||||||||||||||
| 52 | }, | ||||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||||
| 54 | 'title' => "Posting Guidelines", | ||||||||||||||||||||||||||||||
| 55 | 'func' => "render_guidelines", | ||||||||||||||||||||||||||||||
| 56 | 'id' => "post_guidelines", | ||||||||||||||||||||||||||||||
| 57 | }, | ||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||
| 59 | 'title' => "Subscribing to the Mailing-List", | ||||||||||||||||||||||||||||||
| 60 | 'func' => "render_subscribe", | ||||||||||||||||||||||||||||||
| 61 | 'id' => "subscribe", | ||||||||||||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||
| 64 | 'title' => "Unsubscribing from the Mailing-List", | ||||||||||||||||||||||||||||||
| 65 | 'func' => "render_unsubscribe", | ||||||||||||||||||||||||||||||
| 66 | 'id' => "unsubscribe", | ||||||||||||||||||||||||||||||
| 67 | }, | ||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||
| 69 | 'title' => "Posting Messages to the Mailing-List", | ||||||||||||||||||||||||||||||
| 70 | 'func' => "render_post", | ||||||||||||||||||||||||||||||
| 71 | 'id' => "posting", | ||||||||||||||||||||||||||||||
| 72 | }, | ||||||||||||||||||||||||||||||
| 73 | { | ||||||||||||||||||||||||||||||
| 74 | 'title' => "Contacting the Mailing-List's Owner", | ||||||||||||||||||||||||||||||
| 75 | 'func' => "render_owner", | ||||||||||||||||||||||||||||||
| 76 | 'id' => "owner", | ||||||||||||||||||||||||||||||
| 77 | }, | ||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||
| 79 | 'title' => "The Mailing-List's Homepage", | ||||||||||||||||||||||||||||||
| 80 | 'func' => "render_homepage", | ||||||||||||||||||||||||||||||
| 81 | 'id' => "homepage", | ||||||||||||||||||||||||||||||
| 82 | }, | ||||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||||
| 84 | 'title' => "Online Messages Archive", | ||||||||||||||||||||||||||||||
| 85 | 'func' => "render_online_archive", | ||||||||||||||||||||||||||||||
| 86 | 'id' => "archive", | ||||||||||||||||||||||||||||||
| 87 | }, | ||||||||||||||||||||||||||||||
| 88 | ); | ||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||
| 90 | sub _do_nothing | ||||||||||||||||||||||||||||||
| 91 | ▶ | { | |||||||||||||||||||||||||||||
|
Subroutine
_do_nothing: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||
| 94 | sub initialize | ||||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||
|
Subroutine
initialize: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||
| 98 | 0 | my ($key, $value); | |||||||||||||||||||||||||||||
| 99 | 0 | $self->{'title'} = "List of Mailing Lists"; | |||||||||||||||||||||||||||||
| 100 | 0 | $self->{'headline'} = "List of Mailing Lists"; | |||||||||||||||||||||||||||||
| 101 | 0 | $self->{'prolog'} = $self->{'epilog'} = \&_do_nothing; | |||||||||||||||||||||||||||||
| 102 | 0 | $self->{'extra_classes'} = {}; | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | while(scalar(@_)) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||
| 105 | 0 | $key = shift; | |||||||||||||||||||||||||||||
| 106 | 0 | $value = shift; | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ($key =~ /^-?lists$/) | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||
| 109 | 0 | $self->{'lists'} = $value; | |||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||
| 111 | elsif ($key =~ /^-?title$/) | ||||||||||||||||||||||||||||||
| 112 | { | ||||||||||||||||||||||||||||||
| 113 | 0 | $self->{'title'} = $value; | |||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||
| 115 | elsif ($key =~ /^-?headline$/) | ||||||||||||||||||||||||||||||
| 116 | { | ||||||||||||||||||||||||||||||
| 117 | 0 | $self->{'headline'} = $value; | |||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||
| 119 | elsif ($key =~ /^-?extra-classes$/) | ||||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||||
| 121 | 0 | $self->{'extra_classes'} = $value; | |||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||
| 123 | elsif ($key =~ /^-?prolog$/) | ||||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||||
| 125 | 0 | $self->{'prolog'} = $value; | |||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||
| 127 | elsif ($key =~ /^-?epilog$/) | ||||||||||||||||||||||||||||||
| 128 | { | ||||||||||||||||||||||||||||||
| 129 | 0 | $self->{'epilog'} = $value; | |||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if (!exists($self->{'lists'})) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||||
| 135 | 0 | die "The lists were not defined for Mail::LMLM!"; | |||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||
| 137 | 0 | return 0; | |||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||
| 140 | sub render | ||||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||
|
Subroutine
render: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||
| 144 | 0 | my ($mail_lister, $mailing_list, $o, $r, $main_o, $main_r, $filename); | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||
| 146 | 0 | local(*INDEX); | |||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||
| 148 | 0 | open INDEX, ">index.html"; | |||||||||||||||||||||||||||||
| 149 | 0 | $main_r = Mail::LMLM::Render::HTML->new(\*INDEX); | |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||
| 151 | $main_r->start_document( | ||||||||||||||||||||||||||||||
| 152 | $self->{'title'}, | ||||||||||||||||||||||||||||||
| 153 | 0 | $self->{'headline'}, | |||||||||||||||||||||||||||||
| 154 | ); | ||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||
| 156 | 0 | $self->{'prolog'}->($self, $main_r); | |||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||
| 158 | 0 | local(*O); | |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||
| 160 | 0 | foreach $mailing_list (@{$self->{'lists'}}) | |||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||||
| 162 | 0 | $filename = $mailing_list->{'id'}.".html"; | |||||||||||||||||||||||||||||
| 163 | 0 | open O, ">".$filename; | |||||||||||||||||||||||||||||
| 164 | 0 | $r = Mail::LMLM::Render::HTML->new(\*O); | |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||
| 166 | 0 | my $class_name = $mailing_list->{'class'}; | |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | my $class = $mailing_list_classes{$class_name} || $self->{'extra_classes'}->{$class_name} || die "Mail::LMLM: Unknown Class \"$class_name\""; | ||||||||||||||||||||||||||||
|
Condition0%0/5
$Mail::LMLM::mailing_list_classes{$class_name} || $self->{'extra_classes'}{$class_name} || die(qq[Mail::LMLM: Unknown Class "$class_name"])
$Mail::LMLM::mailing_list_classes{$class_name} or $self->{"extra_classes"}{$class_name}
MC/DC0%0/2
$Mail::LMLM::mailing_list_classes{$class_name} || $self->{'extra_classes'}{$class_name} || die(qq[Mail::LMLM: Unknown Class "$class_name"])
$Mail::LMLM::mailing_list_classes{$class_name}
$self->{"extra_classes"}{$class_name}
Truth table0%0/3
A or B
A= $Mail::LMLM::mailing_list_classes{$class_name}B= $self->{"extra_classes"}{$class_name}
| |||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if (ref($class) eq "CODE") | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||||
| 170 | 0 | $mail_lister = $class->(%$mailing_list); | |||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||
| 172 | else | ||||||||||||||||||||||||||||||
| 173 | { | ||||||||||||||||||||||||||||||
| 174 | 0 | $mail_lister = $class->new(%$mailing_list); | |||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||
| 177 | my $title = exists($mailing_list->{'title'}) ? | ||||||||||||||||||||||||||||||
| 178 | $mailing_list->{'title'} : | ||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | $mailing_list->{'id'}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||
| 181 | 0 | $r->start_document($title, $title); | |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||
| 183 | 0 | foreach my $what (@render_what) | |||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||
| 185 | 0 | my $func = $what->{'func'}; | |||||||||||||||||||||||||||||
| 186 | 0 | $r->start_section($what->{'title'}, +{'id' => $what->{'id'}}); | |||||||||||||||||||||||||||||
| 187 | 0 | $mail_lister->$func($r); | |||||||||||||||||||||||||||||
| 188 | 0 | $r->end_section(); | |||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||
| 191 | 0 | $main_r->start_section($title, {'title_url' => $filename}); | |||||||||||||||||||||||||||||
| 192 | 0 | $mail_lister->render_description($main_r); | |||||||||||||||||||||||||||||
| 193 | 0 | $main_r->end_section(); | |||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||
| 195 | 0 | $r->end_document(); | |||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||
| 197 | 0 | close(O); | |||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||
| 200 | 0 | $self->{'epilog'}->($self, $main_r); | |||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||
| 202 | 0 | $main_r->end_document(); | |||||||||||||||||||||||||||||
| 203 | 0 | close(INDEX); | |||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||
| 205 | 0 | local(*STYLE); | |||||||||||||||||||||||||||||
| 206 | 0 | open STYLE, ">style.css"; | |||||||||||||||||||||||||||||
| 207 | 0 | print STYLE <<"EOF"; | |||||||||||||||||||||||||||||
| 208 | a:hover { background-color : LightGreen } | ||||||||||||||||||||||||||||||
| 209 | div.indent { margin-left : 3em } | ||||||||||||||||||||||||||||||
| 210 | EOF | ||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||
| 212 | 0 | close(STYLE); | |||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||
| 215 | #### Documentation | ||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||
| 217 | __END__ | ||||||||||||||||||||||||||||||