| 1 | package WWW::Noss::GroupConfig; | ||||||||||||
| 2 | 2 | ▶ | use 5.016; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 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 | 2 | our $VERSION = '2.05'; | |||||||||||
| 6 | |||||||||||||
| 7 | 2 | ▶ | use parent 'WWW::Noss::BaseConfig'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 5 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 10 | |||||||||||||
| 11 | 5 | my ($class, %param) = @_; | |||||||||||
| 12 | |||||||||||||
| 13 | 5 | my $self = bless {}, $class; | |||||||||||
| 14 | |||||||||||||
| 15 | 5 | $self->initialize(%param); | |||||||||||
| 16 | |||||||||||||
| 17 | 5 | return $self; | |||||||||||
| 18 | |||||||||||||
| 19 | } | ||||||||||||
| 20 | |||||||||||||
| 21 | 5 | ▶ | sub initialize { | ||||||||||
|
Subroutine
initialize: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 22 | |||||||||||||
| 23 | 5 | my ($self, %param) = @_; | |||||||||||
| 24 | |||||||||||||
| 25 | 5 | $self->SUPER::initialize(%param); | |||||||||||
| 26 | 5 | $self->set_name($param{ name }); | |||||||||||
| 27 | 5 | ▶ | $self->set_feeds($param{ feeds } // []); | ||||||||||
|
Condition100%2/2
$param{"feeds"} // []
MC/DC100%1/1
$param{"feeds"} // []
$param{"feeds"}
Truth table100%2/2
A
A= $param{"feeds"}
| |||||||||||||
| 28 | |||||||||||||
| 29 | 5 | return 1; | |||||||||||
| 30 | |||||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | 22 | ▶ | sub name { | ||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 34 | |||||||||||||
| 35 | 22 | my ($self) = @_; | |||||||||||
| 36 | |||||||||||||
| 37 | 22 | return $self->{ Name }; | |||||||||||
| 38 | |||||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 5 | ▶ | sub set_name { | ||||||||||
|
Subroutine
set_name: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||
| 42 | |||||||||||||
| 43 | 5 | my ($self, $new) = @_; | |||||||||||
| 44 | |||||||||||||
| 45 | 5 | ▶ | unless (defined $new) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 46 | 0 | die "group name cannot be undefined"; | |||||||||||
| 47 | } | ||||||||||||
| 48 | |||||||||||||
| 49 | # ':' groups are reserved for internal use | ||||||||||||
| 50 | 5 | ▶ | unless ($new =~ /^\:?\w+$/) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | 0 | die "group name can only contain alphanumeric characters"; | |||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | 5 | $self->{ Name } = $new; | |||||||||||
| 55 | |||||||||||||
| 56 | } | ||||||||||||
| 57 | |||||||||||||
| 58 | 4 | ▶ | sub feeds { | ||||||||||
|
Subroutine
feeds: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 59 | |||||||||||||
| 60 | 4 | my ($self) = @_; | |||||||||||
| 61 | |||||||||||||
| 62 | 4 | return $self->{ Feeds }; | |||||||||||
| 63 | |||||||||||||
| 64 | } | ||||||||||||
| 65 | |||||||||||||
| 66 | 5 | ▶ | sub set_feeds { | ||||||||||
|
Subroutine
set_feeds: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||
| 67 | |||||||||||||
| 68 | 5 | my ($self, $new) = @_; | |||||||||||
| 69 | |||||||||||||
| 70 | 5 | ▶ | unless (ref $new eq 'ARRAY') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 71 | 0 | die "feeds must be an array ref"; | |||||||||||
| 72 | } | ||||||||||||
| 73 | |||||||||||||
| 74 | 5 | $self->{ Feeds } = $new; | |||||||||||
| 75 | |||||||||||||
| 76 | } | ||||||||||||
| 77 | |||||||||||||
| 78 | 3 | ▶ | sub has_feed { | ||||||||||
|
Subroutine
has_feed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 79 | |||||||||||||
| 80 | 3 | my ($self, $feed) = @_; | |||||||||||
| 81 | |||||||||||||
| 82 | 3 | return !! grep { $feed eq $_ } @{ $self->feeds }; | |||||||||||
| 83 | |||||||||||||
| 84 | } | ||||||||||||
| 85 | |||||||||||||
| 86 | 2 | 1; | |||||||||||
| 87 | |||||||||||||
| 88 | =head1 NAME | ||||||||||||
| 89 | |||||||||||||
| 90 | WWW::Noss::GroupConfig - Class for storing feed group configurations | ||||||||||||
| 91 | |||||||||||||
| 92 | =head1 USAGE | ||||||||||||
| 93 | |||||||||||||
| 94 | use WWW::Noss::GroupConfig; | ||||||||||||
| 95 | |||||||||||||
| 96 | my $group = WWW::Noss::GroupConfig->new( | ||||||||||||
| 97 | name => 'name', | ||||||||||||
| 98 | feeds => [ 'feed1', 'feed2' ], | ||||||||||||
| 99 | ); | ||||||||||||
| 100 | |||||||||||||
| 101 | =head1 DESCRIPTION | ||||||||||||
| 102 | |||||||||||||
| 103 | B<WWW::Noss::GroupConfig> is a module that provides a class for storing feed | ||||||||||||
| 104 | group configurations. This is a private module, please consult the L<noss> | ||||||||||||
| 105 | manual for user documentation. | ||||||||||||
| 106 | |||||||||||||
| 107 | =head1 METHODS | ||||||||||||
| 108 | |||||||||||||
| 109 | Not all methods are documented here, as this class is derived from the | ||||||||||||
| 110 | L<WWW::Noss::BaseConfig> module. Consult its documentation for additional | ||||||||||||
| 111 | methods. | ||||||||||||
| 112 | |||||||||||||
| 113 | =over 4 | ||||||||||||
| 114 | |||||||||||||
| 115 | =item $group = WWW::Noss::GroupConfig->new(%param) | ||||||||||||
| 116 | |||||||||||||
| 117 | Returns a blessed B<WWW::Noss::GroupConfig> object based on the parameters | ||||||||||||
| 118 | provided in the C<%param> hash. | ||||||||||||
| 119 | |||||||||||||
| 120 | The following are valid fields for the C<%param> hash. The only required field | ||||||||||||
| 121 | is C<name>. | ||||||||||||
| 122 | |||||||||||||
| 123 | =over 4 | ||||||||||||
| 124 | |||||||||||||
| 125 | =item name | ||||||||||||
| 126 | |||||||||||||
| 127 | Name of the feed group. Can only contain alphanumeric and underscore | ||||||||||||
| 128 | characters. | ||||||||||||
| 129 | |||||||||||||
| 130 | =item feeds | ||||||||||||
| 131 | |||||||||||||
| 132 | Array ref of feed names that the group contains. | ||||||||||||
| 133 | |||||||||||||
| 134 | =back | ||||||||||||
| 135 | |||||||||||||
| 136 | The following fields from the L<WWW::Noss::BaseConfig> module are also | ||||||||||||
| 137 | available: | ||||||||||||
| 138 | |||||||||||||
| 139 | =over 4 | ||||||||||||
| 140 | |||||||||||||
| 141 | =item limit | ||||||||||||
| 142 | |||||||||||||
| 143 | =item respect_skip | ||||||||||||
| 144 | |||||||||||||
| 145 | =item include_title | ||||||||||||
| 146 | |||||||||||||
| 147 | =item exclude_title | ||||||||||||
| 148 | |||||||||||||
| 149 | =item include_content | ||||||||||||
| 150 | |||||||||||||
| 151 | =item exclude_content | ||||||||||||
| 152 | |||||||||||||
| 153 | =item include_tags | ||||||||||||
| 154 | |||||||||||||
| 155 | =item exclude_tags | ||||||||||||
| 156 | |||||||||||||
| 157 | =item autoread | ||||||||||||
| 158 | |||||||||||||
| 159 | =item default_update | ||||||||||||
| 160 | |||||||||||||
| 161 | =item hidden | ||||||||||||
| 162 | |||||||||||||
| 163 | =item open | ||||||||||||
| 164 | |||||||||||||
| 165 | =item user_agent | ||||||||||||
| 166 | |||||||||||||
| 167 | =back | ||||||||||||
| 168 | |||||||||||||
| 169 | =item $name = $group->name() | ||||||||||||
| 170 | |||||||||||||
| 171 | =item $group->set-name($name) | ||||||||||||
| 172 | |||||||||||||
| 173 | Getter/setter for the group's name attribute. | ||||||||||||
| 174 | |||||||||||||
| 175 | =item $feeds = $group->feeds() | ||||||||||||
| 176 | |||||||||||||
| 177 | =item $group->set_feeds($feeds) | ||||||||||||
| 178 | |||||||||||||
| 179 | Getter/setter for the group's feeds attribute. | ||||||||||||
| 180 | |||||||||||||
| 181 | =item $ok = $group->has_feed($feed) | ||||||||||||
| 182 | |||||||||||||
| 183 | Returns true if C<$group> has the feed C<$feed>. | ||||||||||||
| 184 | |||||||||||||
| 185 | =back | ||||||||||||
| 186 | |||||||||||||
| 187 | =head1 AUTHOR | ||||||||||||
| 188 | |||||||||||||
| 189 | Written by Samuel Young, E<lt>samyoung@posteo.comE<gt>. | ||||||||||||
| 190 | |||||||||||||
| 191 | This project's source can be found on its | ||||||||||||
| 192 | L<Codeberg page|https://codeberg.org/1-1sam/noss.git>. Comments and pull | ||||||||||||
| 193 | requests are welcome! | ||||||||||||
| 194 | |||||||||||||
| 195 | =head1 COPYRIGHT | ||||||||||||
| 196 | |||||||||||||
| 197 | Copyright (C) 2025-2026 Samuel Young | ||||||||||||
| 198 | |||||||||||||
| 199 | This program is free software: you can redistribute it and/or modify | ||||||||||||
| 200 | it under the terms of the GNU General Public License as published by | ||||||||||||
| 201 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||
| 202 | (at your option) any later version. | ||||||||||||
| 203 | |||||||||||||
| 204 | =head1 SEE ALSO | ||||||||||||
| 205 | |||||||||||||
| 206 | L<WWW::Noss::BaseConfig>, L<WWW::Noss::FeedConfig>, L<noss> | ||||||||||||
| 207 | |||||||||||||
| 208 | =cut | ||||||||||||
| 209 | |||||||||||||
| 210 | # vim: expandtab shiftwidth=4 | ||||||||||||