| 1 | package Feed::Source::Yahoo; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use URI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use constant { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | URL => "http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml", | |||||||||
| 10 | 2 | }; | |||||||||
| 11 | |||||||||||
| 12 | =head1 NAME | ||||||||||
| 13 | |||||||||||
| 14 | Feed::Source::Yahoo - Create a RSS feed based on a Yahoo query | ||||||||||
| 15 | |||||||||||
| 16 | =head1 VERSION | ||||||||||
| 17 | |||||||||||
| 18 | Version 0.01 | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | 2 | our $VERSION = '0.01'; | |||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | If you query Yahoo regurlarly with the same search, maybe is it a good idea to | ||||||||||
| 27 | transform this query in a RSS feed. This simple module can help you : | ||||||||||
| 28 | |||||||||||
| 29 | use Feed::Source::Yahoo; | ||||||||||
| 30 | |||||||||||
| 31 | my $feed = Feed::Source::Yahoo->new( query => '"information retrieval"'); | ||||||||||
| 32 | print "The feed URL: " . $feed->url() . "\n"; | ||||||||||
| 33 | |||||||||||
| 34 | =head1 FUNCTIONS | ||||||||||
| 35 | |||||||||||
| 36 | =head2 new | ||||||||||
| 37 | |||||||||||
| 38 | =cut | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 41 | 0 | my ($class, %arg) = @_; | |||||||||
| 42 | 0 | my $self = {}; | |||||||||
| 43 | |||||||||||
| 44 | 0 | $self->{URI} = URI->new(URL); | |||||||||
| 45 | 0 | $self->{params}{appid} = "yahoosearchwebrss"; | |||||||||
| 46 | 0 | ▶ | $self->{params}{query} = $arg{query} if exists $arg{query}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | bless $self, $class; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | =head2 url | ||||||||||
| 51 | |||||||||||
| 52 | =cut | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub url { | ||||||||
|
Subroutine
url: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 55 | 0 | my ($self) = @_; | |||||||||
| 56 | 0 | ▶ | if (exists $self->{params}{query}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | $self->{URI}->query_form($self->{params}); | |||||||||
| 58 | $self->{URI}->as_string | ||||||||||
| 59 | 0 | } else { | |||||||||
| 60 | 0 | croak "You must specify a query..."; | |||||||||
| 61 | } | ||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | =head2 query | ||||||||||
| 65 | |||||||||||
| 66 | =cut | ||||||||||
| 67 | |||||||||||
| 68 | 0 | ▶ | sub query { | ||||||||
|
Subroutine
query: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 69 | 0 | my $self = shift; | |||||||||
| 70 | 0 | ▶ | $self->{params}{query} = shift if @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | =head1 AUTHOR | ||||||||||
| 75 | |||||||||||
| 76 | Emmanuel Di Pretoro, C<< <<manu at bjornoya.net>> >> | ||||||||||
| 77 | |||||||||||
| 78 | =head1 BUGS | ||||||||||
| 79 | |||||||||||
| 80 | Please report any bugs or feature requests to | ||||||||||
| 81 | C<bug-feed-source-yahoo at rt.cpan.org>, or through the web interface at | ||||||||||
| 82 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Feed-Source-Yahoo>. | ||||||||||
| 83 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||
| 84 | your bug as I make changes. | ||||||||||
| 85 | |||||||||||
| 86 | =head1 SUPPORT | ||||||||||
| 87 | |||||||||||
| 88 | You can find documentation for this module with the perldoc command. | ||||||||||
| 89 | |||||||||||
| 90 | perldoc Feed::Source::Yahoo | ||||||||||
| 91 | |||||||||||
| 92 | You can also look for information at: | ||||||||||
| 93 | |||||||||||
| 94 | =over 4 | ||||||||||
| 95 | |||||||||||
| 96 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 97 | |||||||||||
| 98 | L<http://annocpan.org/dist/Feed-Source-Yahoo> | ||||||||||
| 99 | |||||||||||
| 100 | =item * CPAN Ratings | ||||||||||
| 101 | |||||||||||
| 102 | L<http://cpanratings.perl.org/d/Feed-Source-Yahoo> | ||||||||||
| 103 | |||||||||||
| 104 | =item * RT: CPAN's request tracker | ||||||||||
| 105 | |||||||||||
| 106 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Feed-Source-Yahoo> | ||||||||||
| 107 | |||||||||||
| 108 | =item * Search CPAN | ||||||||||
| 109 | |||||||||||
| 110 | L<http://search.cpan.org/dist/Feed-Source-Yahoo> | ||||||||||
| 111 | |||||||||||
| 112 | =back | ||||||||||
| 113 | |||||||||||
| 114 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 115 | |||||||||||
| 116 | =head1 COPYRIGHT & LICENSE | ||||||||||
| 117 | |||||||||||
| 118 | Copyright 2006 Manu, all rights reserved. | ||||||||||
| 119 | |||||||||||
| 120 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 121 | under the same terms as Perl itself. | ||||||||||
| 122 | |||||||||||
| 123 | =cut | ||||||||||
| 124 | |||||||||||
| 125 | 2 | 1; # End of Feed::Source::Yahoo | |||||||||