File Coverage

blib/lib/Feed/Data/BBC.pm
Criterion Covered Total %
statement 46 46 100.0
branch n/a
condition n/a
subroutine 16 16 100.0
pod n/a
total 62 62 100.0


line stmt bran cond sub pod time code
1             package Feed::Data::BBC;
2              
3 2     2   225536 use 5.006;
  2         7  
4 2     2   16 use strict;
  2         9  
  2         64  
5 2     2   9 use warnings;
  2         4  
  2         139  
6             our $VERSION = '0.04';
7              
8 2     2   1498 use Rope;
  2         22012  
  2         18  
9 2     2   1839 use Rope::Autoload;
  2         9116  
  2         15  
10 2     2   1481 use Feed::Data::BBC::England;
  2         8  
  2         121  
11 2     2   1376 use Feed::Data::BBC::Africa;
  2         9  
  2         101  
12 2     2   1180 use Feed::Data::BBC::Asia;
  2         8  
  2         81  
13 2     2   1091 use Feed::Data::BBC::Europe;
  2         44  
  2         89  
14 2     2   1092 use Feed::Data::BBC::LatinAmerica;
  2         8  
  2         84  
15 2     2   1122 use Feed::Data::BBC::MiddleEast;
  2         27  
  2         84  
16 2     2   1130 use Feed::Data::BBC::UsAndCanada;
  2         8  
  2         99  
17 2     2   1210 use Feed::Data::BBC::NorthernIreland;
  2         35  
  2         81  
18 2     2   1130 use Feed::Data::BBC::Scotland;
  2         8  
  2         86  
19 2     2   1182 use Feed::Data::BBC::Wales;
  2         7  
  2         936  
20              
21             for my $country (qw/england africa asia europe latin_america middle_east us_and_canada northern_ireland scotland wales/) {
22             property $country => (
23             initable => 1,
24             enumerable => 1,
25             writeable => 0,
26             configurable => 1,
27             builder => sub {
28             _feed_info($_[0], $country);
29             }
30             );
31             }
32              
33             sub _feed_info {
34 10     10   43 my @info = $_[0]->{properties}->{feed_info}->{value}(undef, $_[1]);
35 10         110 $info[0]->new(
36             url => $info[1]
37             );
38             }
39              
40             function feed_info => sub {
41             my ($self, $locale) = @_;
42             (my $mod = $locale) =~ s/_([^_]+)/ucfirst($1)/eg;
43             return (
44             sprintf("Feed::Data::BBC::%s", ucfirst($mod)),
45             sprintf("https://feeds.bbci.co.uk/news%s/%s/rss.xml", ($locale =~ m/^(england|northern_ireland|scotland|wales)$/ ? '' : '/world'), $locale)
46             );
47             };
48              
49             1;
50              
51             __END__
52              
53             =head1 NAME
54              
55             Feed::Data::BBC - BBC rss feeds
56              
57             =head1 VERSION
58              
59             Version 0.04
60              
61             =cut
62              
63             =head1 SYNOPSIS
64              
65             use Feed::Data::BBC;
66              
67             my $bbc = Feed::Data::BBC->new();
68              
69             for my $feed (qw/england africa asia europe latin_america middle_east us_and_canada/) {
70             my $data = $bbc->$feed;
71             $data->parse;
72             $data->render;
73             }
74              
75             =head1 SUBROUTINES/METHODS
76              
77             =head2 england
78              
79             =head2 africa
80              
81             =head2 asia
82              
83             =head2 europe
84              
85             =head2 latin_america
86              
87             =head2 middle_east
88              
89             =head2 us_and_canada
90              
91             =head2 northern_ireland
92              
93             =head2 scotland
94              
95             =head2 wales
96              
97             See L<Feed::Data> for more information.
98              
99             =head1 AUTHOR
100              
101             LNATION, C<< <email at lnation.org> >>
102              
103             =head1 BUGS
104              
105             Please report any bugs or feature requests to C<bug-feed-data-bbc at rt.cpan.org>, or through
106             the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Feed-Data-BBC>. I will be notified, and then you'll
107             automatically be notified of progress on your bug as I make changes.
108              
109             =head1 SUPPORT
110              
111             You can find documentation for this module with the perldoc command.
112              
113             perldoc Feed::Data::BBC
114              
115             You can also look for information at:
116              
117             =over 4
118              
119             =item * RT: CPAN's request tracker (report bugs here)
120              
121             L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Feed-Data-BBC>
122              
123             =item * CPAN Ratings
124              
125             L<https://cpanratings.perl.org/d/Feed-Data-BBC>
126              
127             =item * Search CPAN
128              
129             L<https://metacpan.org/release/Feed-Data-BBC>
130              
131             =back
132              
133             =head1 ACKNOWLEDGEMENTS
134              
135             =head1 LICENSE AND COPYRIGHT
136              
137             This software is Copyright (c) 2024 by LNATION.
138              
139             This is free software, licensed under:
140              
141             The Artistic License 2.0 (GPL Compatible)
142              
143             =cut
144              
145             1; # End of Feed::Data::BBC