line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::KakakuCom::Parser; |
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
1942
|
use XML::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use WebService::KakakuCom::Product; |
6
|
|
|
|
|
|
|
use WebService::KakakuCom::ResultSet; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _parse { |
9
|
|
|
|
|
|
|
my ($class, $xml, @parse_opt) = @_; |
10
|
|
|
|
|
|
|
my $p = XML::Simple->new; |
11
|
|
|
|
|
|
|
my $data = $p->XMLin($xml, @parse_opt); |
12
|
|
|
|
|
|
|
if (WebService::KakakuCom->debug) { |
13
|
|
|
|
|
|
|
require Data::Dumper; |
14
|
|
|
|
|
|
|
warn Data::Dumper::Dumper($data); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
$data; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub parse_for_search { |
20
|
|
|
|
|
|
|
my ($class, $xml) = @_; |
21
|
|
|
|
|
|
|
my $data = $class->_parse($xml, ForceArray => [qw/Item/]); |
22
|
|
|
|
|
|
|
my @results = map WebService::KakakuCom::Product->new($_), @{$data->{Item}}; |
23
|
|
|
|
|
|
|
WebService::KakakuCom::ResultSet->new({ |
24
|
|
|
|
|
|
|
results => \@results, |
25
|
|
|
|
|
|
|
NumOfResult => $data->{NumOfResult} || 0, |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub parse_for_product { |
30
|
|
|
|
|
|
|
my ($class, $xml) = @_; |
31
|
|
|
|
|
|
|
my $data = $class->_parse($xml); |
32
|
|
|
|
|
|
|
$data->{Item} ? WebService::KakakuCom::Product->new($data->{Item}) : return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |