File Coverage

blib/lib/Feed/Data/CNN.pm
Criterion Covered Total %
statement 31 31 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 42 42 100.0


line stmt bran cond sub pod time code
1             package Feed::Data::CNN;
2              
3 2     2   267250 use 5.006;
  2         9  
4 2     2   15 use strict;
  2         8  
  2         66  
5 2     2   8 use warnings;
  2         4  
  2         152  
6              
7             our $VERSION = '0.03';
8              
9 2     2   1583 use Rope;
  2         25422  
  2         15  
10 2     2   1824 use Rope::Autoload;
  2         7277  
  2         12  
11 2     2   1297 use Feed::Data::CNN::TopStories;
  2         27  
  2         89  
12 2     2   1204 use Feed::Data::CNN::AllPolitics;
  2         7  
  2         96  
13 2     2   981 use Feed::Data::CNN::Health;
  2         16  
  2         75  
14 2     2   960 use Feed::Data::CNN::Tech;
  2         5  
  2         64  
15 2     2   916 use Feed::Data::CNN::Showbiz;
  2         7  
  2         687  
16              
17             for my $feed (qw/top_stories all_politics health tech showbiz/) {
18             property $feed => (
19             initable => 1,
20             enumerable => 1,
21             writeable => 0,
22             configurable => 1,
23             builder => sub {
24             _feed_info($_[0], $feed);
25             }
26             );
27             }
28              
29             sub _feed_info {
30 5     5   33 my @info = $_[0]->{properties}->{feed_info}->{value}(undef, $_[1]);
31 5         48 $info[0]->new(
32             url => $info[1]
33             );
34             }
35              
36             function feed_info => sub {
37             my ($self, $locale) = @_;
38             (my $mod = $locale) =~ s/_([^_]+)/ucfirst($1)/eg;
39             $locale =~ s/_//g;
40             return (
41             sprintf("Feed::Data::CNN::%s", ucfirst($mod)),
42             sprintf("http://rss.cnn.com/rss/cnn_%s.rss", $locale)
43             );
44             };
45              
46              
47             1;
48              
49             __END__
50              
51             =head1 NAME
52              
53             Feed::Data::CNN - CNN rss feeds.
54              
55             =head1 VERSION
56              
57             Version 0.03
58              
59             =cut
60              
61             =head1 SYNOPSIS
62              
63             use Feed::Data::CNN;
64              
65             my $cnn = Feed::Data::CNN->new();
66              
67             for my $feed (qw/top_stories all_politics health tech showbiz/) {
68             my $data = $cnn->$feed;
69             $data->parse;
70             $data->render;
71             }
72              
73             =head1 SUBROUTINES/METHODS
74              
75             =head2 top_stories
76              
77             =head2 all_politics
78              
79             =head2 health
80              
81             =head2 tech
82              
83             =head2 showbiz
84              
85             See L<Feed::Data> for more information.
86              
87             =head1 AUTHOR
88              
89             LNATION, C<< <email at lnation.org> >>
90              
91             =head1 BUGS
92              
93             Please report any bugs or feature requests to C<bug-feed-data-cnn at rt.cpan.org>, or through
94             the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Feed-Data-CNN>. I will be notified, and then you'll
95             automatically be notified of progress on your bug as I make changes.
96              
97             =head1 SUPPORT
98              
99             You can find documentation for this module with the perldoc command.
100              
101             perldoc Feed::Data::CNN
102              
103             You can also look for information at:
104              
105             =over 4
106              
107             =item * RT: CPAN's request tracker (report bugs here)
108              
109             L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Feed-Data-CNN>
110              
111             =item * CPAN Ratings
112              
113             L<https://cpanratings.perl.org/d/Feed-Data-CNN>
114              
115             =item * Search CPAN
116              
117             L<https://metacpan.org/release/Feed-Data-CNN>
118              
119             =back
120              
121             =head1 ACKNOWLEDGEMENTS
122              
123             =head1 LICENSE AND COPYRIGHT
124              
125             This software is Copyright (c) 2024 by LNATION.
126              
127             This is free software, licensed under:
128              
129             The Artistic License 2.0 (GPL Compatible)
130              
131             =cut
132              
133             1; # End of Feed::Data::CNN