#!/usr/bin/perl
use strict;
use warnings;
use Cache::File;
my $cache = Cache::File->new(cache_root => '/var/tmp/cache-test',
lock_level => Cache::File::LOCK_LOCAL(),
default_expires => '3 weeks');
my $key = "Yokuaru Namae";
my $data = $cache->get($key);
if ($data) {
print "$key -> $data\n";
} else {
$data = "Taro Yamada";
$cache->set($key, $data, '10 minutes');
}
$key = "1374";
my Cache::Entry $entry = $cache->entry($key);
if ($entry->exists()) {
$data = $entry->get();
} else {
$data = "imi nashi san kyuu";
$entry->set($data, '10 minutes');
}
print $entry->key(), " -> ", $entry->get(), "\n";
print "size = ", $entry->size(), "\n";
$entry->set_expiry('10 minutes');
#$entry->remove();
#!/usr/bin/perl
use strict;
use warnings;
use Net::Amazon;
use Cache::File;
use Encode;
binmode STDOUT, ":utf8";
my $cache = Cache::File->new(cache_root => '/var/tmp/cache-amazon',
lock_level => Cache::File::LOCK_LOCAL(),
default_expires => '24 hours');
my $ua = Net::Amazon->new(token => 'YOUR_TOKEN',
locale => 'jp',
cache => $cache,
max_pages => 1,
);
#my $response = $ua->search(asin => '4873110505');
#my $response = $ua->search(blended => "Perl");
my $response = $ua->search(keyword => "Perl", mode => "books-jp");
#my $response = $ua->search(keyword => "Perl", mode => "books");
if (not $response->is_success()) {
print "Error: ", $response->message(), "\n";
exit;
}
print $response->as_string(), "\n";
for ($response->properties()) {
print "Asin()\t", $_->Asin(), "\n";
print "ProductName()\t", $_->ProductName(), "\n";
print "Availability()\t", $_->Availability(), "\n";
print "Catalog()\t", $_->Catalog(), "\n";
print "authors()\t", $_->authors(), "\n";
#print "Authors()\t", $_->Authors(), "\n";
print "ReleaseDate()\t", $_->ReleaseDate(), "\n";
print "Manufacturer()\t", $_->Manufacturer(), "\n";
print "ImageUrlSmall()\t", $_->ImageUrlSmall(), "\n";
print "ImageUrlMedium()\t", $_->ImageUrlMedium(), "\n";
print "ImageUrlLarge()\t", $_->ImageUrlLarge(), "\n";
print "ListPrice()\t", $_->ListPrice(), "\n";
print "OurPrice()\t", $_->OurPrice(), "\n";
print "UsedPrice()\t", $_->UsedPrice(), "\n";
print "SalesRank()\t", $_->SalesRank(), "\n";
print "Media()\t", $_->Media(), "\n";
print "NumMedia()\t", $_->NumMedia(), "\n";
print "ProductDescription()\t", $_->ProductDescription(), "\n";
print "CollectiblePrice()\t", $_->CollectiblePrice(), "\n";
print "CollectibleCount()\t", $_->CollectibleCount(), "\n";
print "NumberOfOfferings()\t", $_->NumberOfOfferings(), "\n";
print "UsedCount()\t", $_->UsedCount(), "\n";
print "ThirdPartyNewPrice()\t", $_->ThirdPartyNewPrice(), "\n";
print "ThirdPartyNewCount()\t", $_->ThirdPartyNewCount(), "\n";
print "year()\t", $_->year(), "\n";
print "browse_nodes()\t", $_->browse_nodes(), "\n";
print "similar_asins()\t", $_->similar_asins(), "\n";
}
本ブログの読者たる最高の知識人諸子は、疑いもなく『パーキンソンの法則』山形浩生氏の「パーキンソンの法則書評」
(至誠堂)について熟知されていることであろう。熟知せざる諸賢は、
残念ながら最高の知識人階級に所属されてはおらぬというだけのこと。
さりとてこれが気に病むべきことだというわけでもない。人には器があり、
属する階級というものがある。