1 2package WebService::Technorati; 3use strict; 4use utf8; 5 6use WebService::Technorati::SearchApiQuery; 7use WebService::Technorati::CosmosApiQuery; 8use WebService::Technorati::OutboundApiQuery; 9use WebService::Technorati::AuthorinfoApiQuery; 10use WebService::Technorati::BloginfoApiQuery; 11 12BEGIN { 13 use vars qw ($VERSION); 14 $VERSION = 0.04; 15} 16 17# $Id: Technorati.pm,v 1.4 2004/12/30 23:10:47 ikallen Exp $ 18 19########################################### main pod documentation begin ## 20 21=head1 NAME 22 23WebService::Technorati - a Perl interface to the Technorati web services interface 24 25=head1 SYNOPSIS 26 27 use WebService::Technorati; 28 29 my $apiKey = 'myverylongstringofcharacters'; 30 my $url = 'http://www.arachna.com/roller/page/spidaman'; 31 my $t = WebService::Technorati->new(key => $apiKey); 32 my $q = $t->getCosmosApiQuery($url); 33 $q->execute; 34 35 my $linkedUrl = $q->getLinkQuerySubject(); 36 # do something with the linkedUrl 37 38 my $links = $q->getInboundLinks(); 39 for my $link (@$links) { 40 # do something with the link 41 } 42 43=head1 DESCRIPTION 44 45The Technorati web services interfaces use REST wire protocol with a format 46described at http://developers.technorati.com/ 47 48=head1 USAGE 49 50Please see the test files in t/ and samples in eg/ for examples on how to use 51WebServices::Technorati 52 53=head1 BUGS 54 55No bugs currently open 56 57=head1 SUPPORT 58 59Join the Technorati developers mailing list at 60http://mail.technorati.com/mailman/listinfo/developers 61 62=head1 AUTHOR 63 64 Ian Kallen 65 ikallen _at_ technorati.com 66 http://developers.technorati.com 67 68=head1 COPYRIGHT 69 70This program is free software; you can redistribute 71it and/or modify it under the terms of the following 72Creative Commons License: 73http://creativecommons.org/licenses/by/2.0 74as well as the indemnification provisions of the 75Apache 2.0 style license, the full text of which can be 76found in the LICENSE file included with this module. 77 78=head1 SEE ALSO 79 80perl(1). 81 82=cut 83 84############################################# main pod documentation end ## 85 86 87################################################ subroutine header begin ## 88 89=head2 getCosmosApiQuery 90 91 Usage : getCosmosApiQuery('http://developers.technorati.com') 92 Purpose : Instantiates a CosmosApiQuery with the given url 93 Returns : WebService::Technorati::CosmosApiQuery 94 Argument : a URL 95 Throws : WebService::Technorati::InstantiationException when called 96 : without an api key 97 Comments : WebService::Technorati::CosmosApiQuery is a Perl interface to the Technorati 98 : web services 'cosmos' interface 99 100See Also : WebService::Technorati::CosmosApiQuery 101 102=cut 103 104sub getCosmosApiQuery { 105 my $self = shift; 106 my $url = shift; 107 my $q = WebService::Technorati::CosmosApiQuery->new(key => $self->{'key'}, url => $url); 108 return $q; 109} 110 111=head2 getSearchApiQuery 112 113 Usage : getSearchApiQuery('keyword') 114 Purpose : Instantiates a SearchApiQuery with the given keyword 115 Returns : a WebService::Technorati::SearchApiQuery that may be executed 116 Argument : a keyword search term 117 Throws : WebService::Technorati::InstantiationException when called 118 : without an api key 119 Comments : WebService::Technorati::SearchApiQuery is a Perl interface to the Technorati 120 : web services 'search' interface 121 122See Also : WebService::Technorati::SearchApiQuery 123 124=cut 125 126sub getSearchApiQuery { 127 my $self = shift; 128 my $keyword = shift; 129 my $q = WebService::Technorati::SearchApiQuery->new(key => $self->{'key'}, url => $keyword); 130 return $q; 131} 132 133 134=head2 getOutboundApiQuery 135 136 Usage : getOutboundApiQuery('http://developers.technorati.com') 137 Purpose : Instantiates a OutboundApiQuery with the given url 138 Returns : WebService::Technorati::OutboundApiQuery 139 Argument : a url 140 Throws : WebService::Technorati::InstantiationException when called 141 : without an api key 142 Comments : WebService::Technorati::OutboundApiQuery is a Perl interface to the Technorati 143 : web services 'outbound' interface 144 145See Also : WebService::Technorati::OutboundApiQuery 146 147=cut 148 149sub getOutboundApiQuery { 150 my $self = shift; 151 my $url = shift; 152 my $q = WebService::Technorati::OutboundApiQuery->new(key => $self->{'key'}, url => $url); 153 return $q; 154} 155 156 157=head2 getAuthorinfoApiQuery 158 159 Usage : getAuthorinfoApiQuery('username') 160 Purpose : Instantiates a AuthorinfoApiQuery with the given username 161 Returns : WebService::Technorati::AuthorinfoApiQuery 162 Argument : a url 163 Throws : WebService::Technorati::InstantiationException when called 164 : without an api key 165 Comments : WebService::Technorati::AuthorinfoApiQuery is a Perl interface to the Technorati 166 : web services 'getinfo' interface 167 168See Also : WebService::Technorati::AuthorinfoApiQuery 169 170=cut 171 172sub getAuthorinfoApiQuery { 173 my $self = shift; 174 my $url = shift; 175 my $q = WebService::Technorati::AuthorinfoApiQuery->new(key => $self->{'key'}, url => $url); 176 return $q; 177} 178 179 180=head2 getBloginfoApiQuery 181 182 Usage : getBloginfoApiQuery('http://developers.technorati.com') 183 Purpose : Instantiates a BloginfoApiQuery with the given url 184 Returns : WebService::Technorati::BloginfoApiQuery 185 Argument : a url 186 Throws : WebService::Technorati::InstantiationException when called 187 : without an api key 188 Comments : WebService::Technorati::BloginfoApiQuery is a Perl interface to the Technorati 189 : web services 'bloginfo' interface 190 191See Also : WebService::Technorati::BloginfoApiQuery 192 193=cut 194 195sub getBloginfoApiQuery { 196 my $self = shift; 197 my $url = shift; 198 my $q = WebService::Technorati::BloginfoApiQuery->new(key => $self->{'key'}, url => $url); 199 return $q; 200} 201 202 203 204################################################## subroutine header end ## 205 206 207sub new { 208 my ($class, %params) = @_; 209 if (! exists $params{'key'}) { 210 WebService::Technorati::InstantiationException->throw( 211 "WebService::Technorati must be instantiated with at " . 212 "least 'key => theverylongkeystring'"); 213 } 214 my $self = bless (\%params, ref ($class) || $class); 215 return $self; 216} 217 218 2191; #this line is important and will help the module return a true value 220__END__ 221 222