#!/usr/bin/perl
use strict;
use warnings;
use Net::Amazon;
use Net::Amazon::Request::Wishlist;
use constant DEV_TOKEN => 'HOGEHOGE';
use constant WISHLIST_ID => 'HOGE';
use constant MAX_PAGE => 30;
my $amazon =Net::Amazon->new(token => DEV_TOKEN,
max_pages => MAX_PAGE,
locale => 'jp',
);
my $req = Net::Amazon::Request::Wishlist->new(id => WISHLIST_ID);
my $resp = $amazon->request($req);
$ ./hoge.pl
Can't get wishlist: Net::Amazon::Response::Wishlist=HASH(0x9021dfc)->message() at ./hoge.pl line 57
*** Amazon_old.pm Wed Jun 20 23:56:30 2007
--- Amazon.pm Mon Oct 15 18:28:43 2007
***************
*** 185,192 ****
$res->current_page($ref, $page);
$res->set_total_results($ref);
! my $rc = $res->is_page_error($ref);
if ($rc == 0) {
return $res;
} elsif ($rc == -1) {
last;
--- 185,193 ----
$res->current_page($ref, $page);
$res->set_total_results($ref);
! my $rc = $res->is_page_error($ref, $res);
if ($rc == 0) {
+ last if(defined $page && $page > 0);
return $res;
} elsif ($rc == -1) {
last;
$ install Imager
force install Imager
#!/usr/bin/perl
use strict;
use warnings;
use Imager;
use Getopt::Long;
die "Usage: crop-img.pl fromfile tofile\n"
if (!$ARGV[0]|| !$ARGV[1]);
die "no such file $ARGV[0]\n" if !-f $ARGV[0];
my $file = shift;
my $tofile = shift;
my %option = (
left => 0,
right => 0,
top => 0,
bottom=> 0,
);
GetOptions(\%option,
'left=i' ,
'right=i' ,
'top=i' ,
'bottom=i',
'verbose' ,
) or die "unknown option\n";
my $img = Imager->new();
$img->read(file=>$file) or die $img->errstr();
my ($name) = $file =~ /([^.]*)\.[^.]*$/;
my ($format) = $tofile =~ /[^.]*\.([^.]*)$/;
my $newimg = $img->crop(left=>$option{left},
right=>$img->getwidth-$option{right},
top=>$option{top},
bottom=>$img->getheight-$option{bottom});
if ($option{verbose}) { print "made $name\n"; }
$newimg->write(file=>$tofile) or die $newimg->errstr;
$ crop-img.pl torsokojiro100.jpg test.jpg -l 50 -r 200 -t 50 -b 200
$ for file in $(ls -p *.bmp)
do
crop-img ${file} crop-${file} -v -l 280 -r 270 -t 40 -b 20
done
Author:namikister
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | - | - | - | - | - |