BBC.pm

filter: Statementstmt 100% 56 / 56 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 18 / 18 Podpod n/a totaltotal 100% 76 / 76 CC 2 SCAR 1.0
CC
2
Cov
100%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« BBC/Base.pm ↑ Summary BBC/Africa.pm »
1 package Feed::Data::BBC;
2  
3 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 our $VERSION = '0.04';
7  
8 2 ▶use Rope;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Rope::Autoload;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Feed::Data::BBC::England;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Feed::Data::BBC::Africa;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Feed::Data::BBC::Asia;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Feed::Data::BBC::Europe;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Feed::Data::BBC::LatinAmerica;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use Feed::Data::BBC::MiddleEast;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use Feed::Data::BBC::UsAndCanada;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use Feed::Data::BBC::NorthernIreland;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use Feed::Data::BBC::Scotland;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use Feed::Data::BBC::Wales;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 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 10 ▶ _feed_info($_[0], $country);
Subroutine __ANON__: called CC=1 SCAR=0.0
29 }
30 20 );
31 }
32  
33 sub _feed_info {
34 10 ▶ my @info = $_[0]->{properties}->{feed_info}->{value}(undef, $_[1]);
Subroutine _feed_info: called CC=1 SCAR=0.0
35 10 $info[0]->new(
36 url => $info[1]
37 );
38 }
39  
40 function feed_info => sub {
41 10 ▶ my ($self, $locale) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
42 10 (my $mod = $locale) =~ s/_([^_]+)/ucfirst($1)/eg;
43 return (
44 10 ▶ sprintf("Feed::Data::BBC::%s", ucfirst($mod)),
Branch: 1 branch
BranchTrueFalseTotal
$locale =~ /^(england|northern_ireland|scotland|wales)$/ ? : 4 6 10
45 sprintf("https://feeds.bbci.co.uk/news%s/%s/rss.xml", ($locale =~ m/^(england|northern_ireland|scotland|wales)$/ ? '' : '/world'), $locale)
46 );
47 2 };
48  
49 2 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
« BBC/Base.pm ↑ Summary BBC/Africa.pm »