line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Object::eBay::Attributes; |
2
|
|
|
|
|
|
|
our $VERSION = '0.5.1'; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
1172
|
use Class::Std; { |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
17
|
|
5
|
3
|
|
|
3
|
|
250
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
75
|
|
6
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
133
|
|
7
|
3
|
|
|
3
|
|
16
|
use base qw( Object::eBay ); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
289
|
|
8
|
3
|
|
|
3
|
|
16
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
183
|
|
9
|
3
|
|
|
3
|
|
1030
|
use Object::eBay::Attribute; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1230
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %value_for :ATTR( :get ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub BUILD { |
14
|
0
|
|
|
0
|
0
|
|
my ($self, $ident, $args_ref) = @_; |
15
|
0
|
|
0
|
|
|
|
$value_for{$ident} = $args_ref->{object_details} || {}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
0
|
|
|
sub _maybe_array { ref($_[0]) eq 'ARRAY' ? @{$_[0]} : $_[0] } |
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub find { |
20
|
0
|
|
|
0
|
1
|
|
my ($self, $pattern) = @_; |
21
|
0
|
|
|
|
|
|
my $array = $self->get_details; |
22
|
0
|
0
|
|
|
|
|
return if not ref $array; |
23
|
0
|
|
|
|
|
|
my @sets = map { $_->{AttributeSet} } _maybe_array($array); |
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my @attributes = map { _maybe_array( $_->{Attribute} ) } |
|
0
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
map { _maybe_array($_) } |
26
|
|
|
|
|
|
|
@sets; |
27
|
0
|
|
|
|
|
|
my @needles = ref($pattern) eq 'Regexp' |
28
|
0
|
|
|
|
|
|
? grep { $_->{Value}{ValueLiteral} =~ $pattern } @attributes |
29
|
0
|
0
|
|
|
|
|
: grep { $_->{attributeID} == $pattern } @attributes |
30
|
|
|
|
|
|
|
; |
31
|
0
|
0
|
|
|
|
|
return if not @needles; |
32
|
0
|
|
|
|
|
|
return map { |
33
|
0
|
|
|
|
|
|
Object::eBay::Attribute->new({ attribute => $_ }); |
34
|
|
|
|
|
|
|
} @needles; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |