| 1 | package WWW::Noss::BaseConfig; | ||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use 5.016; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | our $VERSION = '2.05'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use List::Util qw(any all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | my ($class, %param) = @_; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | $self->initialize(%param); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | return $self; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 23 | ▶ | sub initialize { | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=11 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 23 | my ($self, %param) = @_; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 23 | $self->set_limit($param{ limit }); | |||||||||||||||||||||||||||
| 26 | 23 | ▶ | $self->set_respect_skip($param{ respect_skip } // 1); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"respect_skip"} // 1
MC/DC100%1/1
$param{"respect_skip"} // 1
$param{"respect_skip"}
Truth table100%2/2
A
A= $param{"respect_skip"}
| |||||||||||||||||||||||||||||
| 27 | 23 | ▶ | $self->set_include_title($param{ include_title } // []); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"include_title"} // []
MC/DC100%1/1
$param{"include_title"} // []
$param{"include_title"}
Truth table100%2/2
A
A= $param{"include_title"}
| |||||||||||||||||||||||||||||
| 28 | 23 | ▶ | $self->set_exclude_title($param{ exclude_title } // []); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"exclude_title"} // []
MC/DC100%1/1
$param{"exclude_title"} // []
$param{"exclude_title"}
Truth table100%2/2
A
A= $param{"exclude_title"}
| |||||||||||||||||||||||||||||
| 29 | 23 | ▶ | $self->set_include_content($param{ include_content } // []); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"include_content"} // []
MC/DC100%1/1
$param{"include_content"} // []
$param{"include_content"}
Truth table100%2/2
A
A= $param{"include_content"}
| |||||||||||||||||||||||||||||
| 30 | 23 | ▶ | $self->set_exclude_content($param{ exclude_content } // []); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"exclude_content"} // []
MC/DC100%1/1
$param{"exclude_content"} // []
$param{"exclude_content"}
Truth table100%2/2
A
A= $param{"exclude_content"}
| |||||||||||||||||||||||||||||
| 31 | 23 | ▶ | $self->set_include_tags($param{ include_tags } // []); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"include_tags"} // []
MC/DC100%1/1
$param{"include_tags"} // []
$param{"include_tags"}
Truth table100%2/2
A
A= $param{"include_tags"}
| |||||||||||||||||||||||||||||
| 32 | 23 | ▶ | $self->set_exclude_tags($param{ exclude_tags } // []); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"exclude_tags"} // []
MC/DC100%1/1
$param{"exclude_tags"} // []
$param{"exclude_tags"}
Truth table100%2/2
A
A= $param{"exclude_tags"}
| |||||||||||||||||||||||||||||
| 33 | 23 | ▶ | $self->set_autoread($param{ autoread } // 0); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"autoread"} // 0
MC/DC100%1/1
$param{"autoread"} // 0
$param{"autoread"}
Truth table100%2/2
A
A= $param{"autoread"}
| |||||||||||||||||||||||||||||
| 34 | 23 | ▶ | $self->set_default_update($param{ default_update } // 1); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"default_update"} // 1
MC/DC100%1/1
$param{"default_update"} // 1
$param{"default_update"}
Truth table100%2/2
A
A= $param{"default_update"}
| |||||||||||||||||||||||||||||
| 35 | 23 | ▶ | $self->set_hidden($param{ hidden } // 0); | ||||||||||||||||||||||||||
|
Condition100%2/2
$param{"hidden"} // 0
MC/DC100%1/1
$param{"hidden"} // 0
$param{"hidden"}
Truth table100%2/2
A
A= $param{"hidden"}
| |||||||||||||||||||||||||||||
| 36 | 23 | $self->set_open_cmd($param{ open }); | |||||||||||||||||||||||||||
| 37 | 23 | $self->set_user_agent($param{ user_agent }); | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 23 | return 1; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 25 | ▶ | sub limit { | ||||||||||||||||||||||||||
|
Subroutine
limit: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 25 | my ($self) = @_; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 25 | return $self->{ Limit }; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 27 | ▶ | sub set_limit { | ||||||||||||||||||||||||||
|
Subroutine
set_limit: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 27 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 27 | ▶ | if (defined $new and $new <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $new and $new <= 0
MC/DC0%0/2
defined $new and $new <= 0
defined $new
$new <= 0
Truth table66%2/3
A and B
A= defined $newB= $new <= 0
| |||||||||||||||||||||||||||||
| 56 | 0 | die "limit must be greater than 0"; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 27 | $self->{ Limit } = $new; | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 5 | ▶ | sub respect_skip { | ||||||||||||||||||||||||||
|
Subroutine
respect_skip: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 5 | return $self->{ RespectSkip }; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 25 | ▶ | sub set_respect_skip { | ||||||||||||||||||||||||||
|
Subroutine
set_respect_skip: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 25 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 25 | $self->{ RespectSkip } = !! $new; | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 101 | ▶ | sub include_title { | ||||||||||||||||||||||||||
|
Subroutine
include_title: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 101 | my ($self) = @_; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 101 | return $self->{ IncludeTitle }; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 24 | ▶ | sub set_include_title { | ||||||||||||||||||||||||||
|
Subroutine
set_include_title: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 24 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 24 | ▶ | if (ref $new ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | die "include_title must be an array ref"; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 24 | $self->{ IncludeTitle } = $new; | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 95 | ▶ | sub exclude_title { | ||||||||||||||||||||||||||
|
Subroutine
exclude_title: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 95 | my ($self) = @_; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 95 | return $self->{ ExcludeTitle }; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 24 | ▶ | sub set_exclude_title { | ||||||||||||||||||||||||||
|
Subroutine
set_exclude_title: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 24 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 24 | ▶ | if (ref $new ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | die "exclude_title must be an array ref"; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 24 | $self->{ ExcludeTitle } = $new; | |||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 76 | ▶ | sub title_ok { | ||||||||||||||||||||||||||
|
Subroutine
title_ok: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 76 | my ($self, $title) = @_; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 76 | ▶ | if (@{ $self->include_title }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 14 | ▶ | unless (defined $title) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | return 0; | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | 14 | ▶ | unless (all { $title =~ $_ } @{ $self->include_title }) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 4 | return 0; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 72 | ▶ | if (@{ $self->exclude_title }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 12 | ▶ | unless (defined $title) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 0 | return 1; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | 12 | ▶ | if (any { $title =~ $_ } @{ $self->exclude_title }) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 7 | return 0; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 65 | return 1; | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 92 | ▶ | sub include_content { | ||||||||||||||||||||||||||
|
Subroutine
include_content: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 92 | my ($self) = @_; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 92 | return $self->{ IncludeContent }; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 24 | ▶ | sub set_include_content { | ||||||||||||||||||||||||||
|
Subroutine
set_include_content: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 24 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 24 | ▶ | if (ref $new ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | die "include_content must be an array ref"; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 24 | $self->{ IncludeContent } = $new; | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 87 | ▶ | sub exclude_content { | ||||||||||||||||||||||||||
|
Subroutine
exclude_content: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 87 | my ($self) = @_; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 87 | return $self->{ ExcludeContent }; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 24 | ▶ | sub set_exclude_content { | ||||||||||||||||||||||||||
|
Subroutine
set_exclude_content: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 24 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 24 | ▶ | if (ref $new ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | die "exclude_content must be an array ref"; | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 24 | $self->{ ExcludeContent } = $new; | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 67 | ▶ | sub content_ok { | ||||||||||||||||||||||||||
|
Subroutine
content_ok: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 67 | my ($self, $content) = @_; | |||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 67 | ▶ | if (@{ $self->include_content }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 14 | ▶ | unless (defined $content) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | 0 | return 0; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | 14 | ▶ | if (not all { $content =~ $_ } @{ $self->include_content }) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 4 | return 0; | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 63 | ▶ | if (@{ $self->exclude_content }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 13 | ▶ | unless (defined $content) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | return 1; | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | 13 | ▶ | if (any { $content =~ $_ } @{ $self->exclude_content }) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | 8 | return 0; | |||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 55 | return 1; | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 82 | ▶ | sub include_tags { | ||||||||||||||||||||||||||
|
Subroutine
include_tags: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 82 | my ($self) = @_; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 82 | return $self->{ IncludeTags }; | |||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 24 | ▶ | sub set_include_tags { | ||||||||||||||||||||||||||
|
Subroutine
set_include_tags: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 24 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 24 | ▶ | if (ref $new ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 224 | 0 | die "include_tags must be an array ref"; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 24 | $self->{ IncludeTags } = $new; | |||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 70 | ▶ | sub exclude_tags { | ||||||||||||||||||||||||||
|
Subroutine
exclude_tags: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 70 | my ($self) = @_; | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 70 | return $self->{ ExcludeTags }; | |||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 24 | ▶ | sub set_exclude_tags { | ||||||||||||||||||||||||||
|
Subroutine
set_exclude_tags: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 24 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 24 | ▶ | if (ref $new ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 244 | 0 | die "exclude_tags must be an array ref"; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 24 | $self->{ ExcludeTags } = $new; | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 57 | ▶ | sub tags_ok { | ||||||||||||||||||||||||||
|
Subroutine
tags_ok: called CC=8 SCAR=21.0
Pod
documented
| |||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 57 | my ($self, $tags) = @_; | |||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 57 | ▶ | my %tagmap = defined $tags ? (map { fc $_ => 1 } @$tags) : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 57 | ▶ | if (@{ $self->include_tags }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 14 | ▶ | unless (defined $tags) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | 0 | return 0; | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | 14 | ▶ | if (any { not exists $tagmap{ fc $_ } } @{ $self->include_tags }) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 262 | 8 | return 0; | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 49 | ▶ | if (@{ $self->exclude_tags }) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 10 | ▶ | unless (defined $tags) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | 0 | return 1; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | 10 | ▶ | if (any { exists $tagmap{ fc $_ } } @{ $self->exclude_tags }) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | 4 | return 0; | |||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 45 | return 1; | |||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 13 | ▶ | sub autoread { | ||||||||||||||||||||||||||
|
Subroutine
autoread: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 13 | my ($self) = @_; | |||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 13 | return $self->{ Autoread }; | |||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 26 | ▶ | sub set_autoread { | ||||||||||||||||||||||||||
|
Subroutine
set_autoread: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | 26 | my ($self, $read) = @_; | |||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 26 | $self->{ Autoread } = !! $read; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | 6 | ▶ | sub default_update { | ||||||||||||||||||||||||||
|
Subroutine
default_update: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 6 | return $self->{ DefaultUpdate }; | |||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 26 | ▶ | sub set_default_update { | ||||||||||||||||||||||||||
|
Subroutine
set_default_update: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 26 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | 26 | $self->{ DefaultUpdate } = !! $new; | |||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 5 | ▶ | sub hidden { | ||||||||||||||||||||||||||
|
Subroutine
hidden: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 5 | return $self->{ Hidden }; | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 26 | ▶ | sub set_hidden { | ||||||||||||||||||||||||||
|
Subroutine
set_hidden: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | 26 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 26 | $self->{ Hidden } = !! $new; | |||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 7 | ▶ | sub open_cmd { | ||||||||||||||||||||||||||
|
Subroutine
open_cmd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | 7 | my ($self) = @_; | |||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 7 | return $self->{ Open }; | |||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | 26 | ▶ | sub set_open_cmd { | ||||||||||||||||||||||||||
|
Subroutine
set_open_cmd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 26 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 26 | $self->{ Open } = $new; | |||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | 7 | ▶ | sub user_agent { | ||||||||||||||||||||||||||
|
Subroutine
user_agent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 7 | my ($self) = @_; | |||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | 7 | return $self->{ UserAgent }; | |||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | 26 | ▶ | sub set_user_agent { | ||||||||||||||||||||||||||
|
Subroutine
set_user_agent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 26 | my ($self, $new) = @_; | |||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | 26 | $self->{ UserAgent } = $new; | |||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | =head1 NAME | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | WWW::Noss::BaseConfig - Base class for feed configuration classes | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | =head1 USAGE | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | use parent 'WWW::Noss::BaseConfig'; | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | B<WWW::Noss::BaseConfig> is a class that implements the base functionality for | ||||||||||||||||||||||||||||
| 370 | the L<WWW::Noss::FeedConfig> and L<WWW::Noss::GroupConfig> modules. This is a | ||||||||||||||||||||||||||||
| 371 | private module, please consult the L<noss> manual for user documentation. | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | =head1 METHODS | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | =over 4 | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | =item $conf = WWW::Noss::BaseConfig->new(%param) | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | Default constructor for B<WWW::Noss::BaseConfig>. Parameters are supplied via | ||||||||||||||||||||||||||||
| 380 | the C<%param> hash. | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | The following are valid fields for C<%param>: | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | =over 4 | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | =item limit | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | Post limit. Should be an integar that is greater than C<0>, or C<undef> for no | ||||||||||||||||||||||||||||
| 389 | limit. | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | =item respect_skip | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | Boolean determining whether the B<skipHours> and B<skipDays> fields in RSS | ||||||||||||||||||||||||||||
| 394 | feeds should be respected. | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | =item include_title | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | Array ref of regexes that post titles must match in order to not be filtered | ||||||||||||||||||||||||||||
| 399 | out. | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | =item exclude_title | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | Array ref of regexes that post titles must NOT match in order to not be | ||||||||||||||||||||||||||||
| 404 | filtered out. | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | =item include_content | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | Array ref of regexes that a post's content must match in order to not be | ||||||||||||||||||||||||||||
| 409 | filtered out. | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | =item exclude_content | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | Array ref of regexes that a post's content must NOT match in order to not be | ||||||||||||||||||||||||||||
| 414 | filtered out. | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | =item include_tags | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | Array ref of tags that a post must have in order to not be filtered out. | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | =item exclude_tags | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | Array ref of tags that a post must NOT have in order to not be filtered out. | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | =item autoread | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | Boolean determining whether new posts will automatically be marked as read or | ||||||||||||||||||||||||||||
| 427 | not. | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | =item default_update | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | Boolean determining whether a feed should be included in a default update or | ||||||||||||||||||||||||||||
| 432 | not. | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | =item hidden | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | Boolean determining whether a feed should be omitted from the C<list> command's | ||||||||||||||||||||||||||||
| 437 | default listing. | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | =item open | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | Command to use for opening URLs in this feed. | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | =item user_agent | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | String to use as user agent when fetching URLs for this feed. | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | =back | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | =item $limit = $conf->limit() | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | =item $conf->set_limit($limit) | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | Getter/setter for the C<limit> attribute. | ||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | =item $respect = $conf->respect_skip() | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | =item $conf->set_respect_skip($respect) | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | Getter/setter for the C<respect_skip> attribute. | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | =item \@inc = $conf->include_title() | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | =item $conf->set_include_title(\@inc) | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | =item \@exc = $conf->exclude_title() | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | =item $conf->set_exclude_title(\@exc) | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | Getter/setters for the C<include_title> and C<exclude_title> attributes. | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | =item \@inc = $conf->include_content() | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | =item $conf->set_include_content(\@inc) | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | =item \@exc = $conf->exclude_content() | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | =item $conf->set_exclude_content(\@exc) | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | Getter/setters for the C<include_content> and C<exclude_content> attributes. | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | =item \@inc = $conf->include_tags() | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | =item $conf->set_include_tags(\@inc) | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | =item \@exc = $conf->exclude_tags() | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | =item $conf->set_exclude_tags(\@exc) | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | Getter/setters for the C<include_tags> and C<exclude_tags> attributes. | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | =item $autoread = $conf->autoread() | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | =item $conf->set_autoread($autoread) | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | Getter/setter for the C<autoread> attribute. | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | =item $default = $conf->default_update() | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | =item $conf->set_default_update($default) | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | Getter/setter for the C<default_update> attribute. | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | =item $hidden = $conf->hidden() | ||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | =item $conf->set_hidden($hidden) | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | Getter/setter for the C<hidden> attribute. | ||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | =item $open = $conf->open_cmd() | ||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | =item $conf->set_open_cmd($cmd) | ||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||
| 513 | Getter/setter for the C<open> attribute. | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | =item $agent = $conf->user_agent() | ||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | =item $conf->set_user_agent($agent) | ||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | Getter/setter for the C<user_agent> attribute. | ||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | =item $ok = $conf->title_ok($title) | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | =item $ok = $conf->content_ok($content) | ||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | =item $ok = $conf->tags_ok(\@tags) | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | Methods returning a boolean of whether the given title/content/tags are | ||||||||||||||||||||||||||||
| 528 | acceptable according to their respective include and exclude attributes. | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | =back | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||
| 534 | Written by Samuel Young, E<lt>samyoung@posteo.comE<gt>. | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | This project's source can be found on its | ||||||||||||||||||||||||||||
| 537 | L<Codeberg page|https://codeberg.org/1-1sam/noss.git>. Comments and pull | ||||||||||||||||||||||||||||
| 538 | requests are welcome! | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | Copyright (C) 2025-2026 Samuel Young | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 545 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 546 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||
| 547 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||
| 549 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||
| 551 | L<WWW::Noss::FeedConfig>, L<WWW::Noss::GroupConfig>, L<noss> | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | =cut | ||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||
| 555 | 6 | 1; | |||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | # vim: expandtab shiftwidth=4 | ||||||||||||||||||||||||||||