| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package # private |
|
2
|
|
|
|
|
|
|
Net::COLOURlovers::Color; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use JSON qw( from_json ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub color { |
|
10
|
0
|
|
|
0
|
0
|
|
my ( $self, $color ) = @_; |
|
11
|
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $response = |
|
13
|
|
|
|
|
|
|
$self->{'ua'} |
|
14
|
|
|
|
|
|
|
->post("http://www.colourlovers.com/api/color/$color?format=json"); |
|
15
|
0
|
|
|
|
|
|
return ( from_json $response->content )->[0]; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub colors { |
|
19
|
0
|
|
|
0
|
0
|
|
my ( $self, $args, $url ) = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$args = Net::COLOURlovers::_build_parametres( |
|
22
|
|
|
|
|
|
|
$args, |
|
23
|
|
|
|
|
|
|
[ |
|
24
|
|
|
|
|
|
|
qw( |
|
25
|
|
|
|
|
|
|
lover hueRange briRange 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/colors?format=json', |
|
34
|
|
|
|
|
|
|
$args ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return from_json $response->content; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub colors_new { |
|
40
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
|
41
|
0
|
|
|
|
|
|
return $self->colors( $args, |
|
42
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/colors/new?format=json' ); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub colors_top { |
|
46
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
|
47
|
0
|
|
|
|
|
|
return $self->colors( $args, |
|
48
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/colors/top?format=json' ); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub color_random { |
|
52
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
|
53
|
|
|
|
|
|
|
return ( |
|
54
|
0
|
|
|
|
|
|
$self->colors( |
|
55
|
|
|
|
|
|
|
{}, 'http://www.colourlovers.com/api/colors/random?format=json' |
|
56
|
|
|
|
|
|
|
) |
|
57
|
|
|
|
|
|
|
)->[0]; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |