# # - Net::Amazon - # This spec file was automatically generated by cpan2rpm [ver: 2.028] # The following arguments were used: # http://search.cpan.org/CPAN/authors/id/M/MS/MSCHILLI/Net-Amazon-0.35.tar.gz # For more information on cpan2rpm please visit: http://perl.arix.com/ # %define pkgname Net-Amazon %define filelist %{pkgname}-%{version}-filelist %define NVR %{pkgname}-%{version}-%{release} %define maketest 1 name: perl-Net-Amazon summary: Net-Amazon - Framework for accessing amazon.com via SOAP and XML/HTTP version: 0.35 release: 1 vendor: Mike packager: Arix International license: Artistic group: Applications/CPAN url: http://www.cpan.org buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) buildarch: noarch prefix: %(echo %{_prefix}) source: http://search.cpan.org/CPAN/authors/id/M/MS/MSCHILLI/Net-Amazon-0.35.tar.gz %description "Net::Amazon" works very much like "LWP": First you define a useragent like my $ua = Net::Amazon->new( token => 'YOUR_AMZN_TOKEN', max_pages => 3, ); which you pass your personal amazon developer's token (can be obtained from ) and (optionally) the maximum number of result pages the agent is going to request from Amazon in case all results don't fit on a single page (typically holding 20 items). Note that each new page requires a minimum delay of 1 second to comply with Amazon's one-query-per-second policy. According to the different search methods on Amazon, there's a bunch of different request types in "Net::Amazon". The user agent's convenience method "search()" triggers different request objects, depending on which parameters you pass to it: =over 4 =item "$ua->search(asin => "0201360683")" The "asin" parameter has Net::Amazon search for an item with the specified ASIN. If the specified value is an arrayref instead of a single scalar, like in $ua->search(asin => ["0201360683", "0596005083"]) then a search for multiple ASINs is performed, returning a list of results. =item "$ua->search(artist => "Rolling Stones")" The "artist" parameter has the user agent search for items created by the specified artist. Can return many results. =item "$ua->search(browsenode=>"4025", mode=>"books" [, keywords=>"perl"])" Returns a list of items by category ID (node). For example node "4025" is the CGI books category. You can add a keywords parameter to filter the results by that keyword. =item "$ua->search(exchange => 'Y04Y3424291Y2398445')" Returns an item offered by a third-party seller. The item is referenced by the so-called *exchange ID*. =item "$ua->search(keyword => "perl xml", mode => "books")" Search by keyword, mandatory parameters "keyword" and "mode". Can return many results. =item "$ua->search(wishlist => "1XL5DWOUFMFVJ")" Search for all items in a specified wishlist. Can return many results. =item "$ua->search(upc => "075596278324", mode => "music")" Music search by UPC (product barcode), mandatory parameter "upc". "mode" has to be set to "music". Returns at most one result. =item "$ua->search(similar => "0201360683")" Search for all items similar to the one represented by the ASIN provided. Can return many results. =item "$ua->search(power => "subject: perl and author: schwartz", mode => "books")" Initiate a power search for all books matching the power query. Can return many results. See Net::Amazon::Request::Power for details. =item "$ua->search(manufacturer => "o'reilly", mode => "books")" Initiate a search for all items made by a given manufacturrer. Can return many results. See Net::Amazon::Request::Manufacturer for details. =item "$ua->search(blended => "Perl")" Initiate a search for items in all categories. =item "$ua->search(seller => "A2GXAGU54VOP7")" Start a search on items sold by a specific third-party seller, referenced by its ID (not seller name). =item "$ua->search(textstream => "Blah blah Rolling Stones blah blah")" Find items related to keywords within a text stream. =back The user agent's "search" method returns a response object, which can be checked for success or failure: if($resp->is_success()) { print $resp->as_string(); } else { print "Error: ", $resp->message(), "\n"; } In case the request for an item search succeeds, the response contains one or more Amazon 'properties', as it calls the products found. All matches can be retrieved from the Response object using it's "properties()" method. In case the request fails, the response contains one or more error messages. The response object's "message()" method will return it (or them) as a single string, while "messages()" (notice the plural) will return a reference to an array of message strings. Response objects always have the methods "is_success()", "is_error()", "message()", "total_results()", "as_string()" and "properties()" available. "total_results()" returns the total number of results the search yielded. "properties()" returns one or more "Net::Amazon::Property" objects of type "Net::Amazon::Property" (or one of its subclasses like "Net::Amazon::Property::Book", "Net::Amazon::Property::Music" or Net::Amazon::Property::DVD), each of which features accessors named after the attributes of the product found in Amazon's database: for ($resp->properties) { print $_->Asin(), " ", $_->OurPrice(), "\n"; } In scalar context, "properties()" just returns the *first* "Net::Amazon::Property" object found. Commonly available accessors to "Net::Amazon::Property" objects are "OurPrice()", "ImageUrlLarge()", "ImageUrlMedium()", "ImageUrlSmall()", "ReleaseDate()", "Catalog()", "Asin()", "url()", "Manufacturer()", "UsedPrice()", "ListPrice()", "ProductName()", "Availability()", "SalesRank()", "CollectiblePrice()", "CollectibleCount()", "NumberOfOfferings()", "UsedCount()", "ThirdPartyNewPrice()", "ThirdPartyNewCount()", "similar_asins()". For details, check Net::Amazon::Property. Also, the specialized classes "Net::Amazon::Property::Book" and "Net::Amazon::Property::Music" feature convenience methods like "authors()" (returning the list of authors of a book) or "album()" for CDs, returning the album title. Customer reviews: Every property features a "review_set()" method which returns a "Net::Amazon::Attribute::ReviewSet" object, which in turn offers a list of "Net::Amazon::Attribute::Review" objects. Check the respective man pages for details on what's available. # # This package was generated automatically with the cpan2rpm # utility. To get this software or for more information # please visit: http://perl.arix.com/ # %prep %setup -q -n %{pkgname}-%{version} chmod -R u+w %{_builddir}/%{pkgname}-%{version} %build grep -rsl '^#!.*perl' . | grep -v '.bak$' |xargs --no-run-if-empty \ %__perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' CFLAGS="$RPM_OPT_FLAGS" %{__perl} Makefile.PL `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '` %{__make} %if %maketest %{__make} test %endif %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %{makeinstall} `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '` cmd=/usr/share/spec-helper/compress_files [ -x $cmd ] || cmd=/usr/lib/rpm/brp-compress [ -x $cmd ] && $cmd # SuSE Linux if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ] then %{__mkdir_p} %{buildroot}/var/adm/perl-modules %{__cat} `find %{buildroot} -name "perllocal.pod"` \ | %{__sed} -e s+%{buildroot}++g \ > %{buildroot}/var/adm/perl-modules/%{name} fi # remove special files find %{buildroot} -name "perllocal.pod" \ -o -name ".packlist" \ -o -name "*.bs" \ |xargs -i rm -f {} # no empty directories find %{buildroot}%{_prefix} \ -type d -depth \ -exec rmdir {} \; 2>/dev/null %{__perl} -MFile::Find -le ' find({ wanted => \&wanted, no_chdir => 1}, "%{buildroot}"); print "%doc eg Changes README adm"; for my $x (sort @dirs, @files) { push @ret, $x unless indirs($x); } print join "\n", sort @ret; sub wanted { return if /auto$/; local $_ = $File::Find::name; my $f = $_; s|^\Q%{buildroot}\E||; return unless length; return $files[@files] = $_ if -f $f; $d = $_; /\Q$d\E/ && return for reverse sort @INC; $d =~ /\Q$_\E/ && return for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|; $dirs[@dirs] = $_; } sub indirs { my $x = shift; $x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs; } ' > %filelist [ -z %filelist ] && { echo "ERROR: empty %files listing" exit -1 } %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files -f %filelist %defattr(-,root,root) %changelog * Fri May 19 2006 dave@giles.mag-sol.com - Initial build.