| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package # private |
|
2
|
|
|
|
|
|
|
Net::COLOURlovers::Pattern; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
26
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use JSON qw( from_json ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub pattern { |
|
10
|
0
|
|
|
0
|
0
|
|
my ( $self, $pattern ) = @_; |
|
11
|
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $response = |
|
13
|
|
|
|
|
|
|
$self->{'ua'} |
|
14
|
|
|
|
|
|
|
->post("http://www.colourlovers.com/api/pattern/$pattern?format=json"); |
|
15
|
0
|
|
|
|
|
|
return ( from_json $response->content )->[0]; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub patterns { |
|
19
|
0
|
|
|
0
|
0
|
|
my ( $self, $args, $url ) = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$args = Net::COLOURlovers::_build_parametres( |
|
22
|
|
|
|
|
|
|
$args, |
|
23
|
|
|
|
|
|
|
[ |
|
24
|
|
|
|
|
|
|
qw( |
|
25
|
|
|
|
|
|
|
lover hueOption hex keywords keywordExact orderCol sortBy |
|
26
|
|
|
|
|
|
|
numResults resultOffset |
|
27
|
|
|
|
|
|
|
) |
|
28
|
|
|
|
|
|
|
] |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
0
|
|
|
|
my $response = |
|
32
|
|
|
|
|
|
|
$self->{'ua'} |
|
33
|
|
|
|
|
|
|
->post( $url || 'http://www.colourlovers.com/api/patterns?format=json', |
|
34
|
|
|
|
|
|
|
$args ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return from_json $response->content; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub patterns_new { |
|
40
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
|
41
|
0
|
|
|
|
|
|
return $self->patterns( $args, |
|
42
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/patterns/new?format=json' ); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub patterns_top { |
|
46
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
|
47
|
0
|
|
|
|
|
|
return $self->patterns( $args, |
|
48
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/patterns/top?format=json' ); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub pattern_random { |
|
52
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
|
53
|
|
|
|
|
|
|
return ( |
|
54
|
0
|
|
|
|
|
|
$self->patterns( |
|
55
|
|
|
|
|
|
|
{}, 'http://www.colourlovers.com/api/patterns/random?format=json' |
|
56
|
|
|
|
|
|
|
) |
|
57
|
|
|
|
|
|
|
)->[0]; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |