line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # private |
2
|
|
|
|
|
|
|
Net::COLOURlovers::Palette; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
75
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use JSON qw( from_json ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub palette { |
10
|
0
|
|
|
0
|
0
|
|
my ( $self, $palette ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $response = |
13
|
|
|
|
|
|
|
$self->{'ua'} |
14
|
|
|
|
|
|
|
->post("http://www.colourlovers.com/api/palette/$palette?format=json"); |
15
|
0
|
|
|
|
|
|
return ( from_json $response->content )->[0]; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub palettes { |
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 showPaletteWidths |
27
|
|
|
|
|
|
|
) |
28
|
|
|
|
|
|
|
] |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
0
|
|
|
|
my $response = |
32
|
|
|
|
|
|
|
$self->{'ua'} |
33
|
|
|
|
|
|
|
->post( $url || 'http://www.colourlovers.com/api/palettes?format=json', |
34
|
|
|
|
|
|
|
$args ); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return from_json $response->content; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub palettes_new { |
40
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
41
|
0
|
|
|
|
|
|
return $self->palettes( $args, |
42
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/palettes/new?format=json' ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub palettes_top { |
46
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
47
|
0
|
|
|
|
|
|
return $self->palettes( $args, |
48
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/palettes/top?format=json' ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub palette_random { |
52
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
53
|
|
|
|
|
|
|
return ( |
54
|
0
|
|
|
|
|
|
$self->palettes( |
55
|
|
|
|
|
|
|
{}, 'http://www.colourlovers.com/api/palettes/random?format=json' |
56
|
|
|
|
|
|
|
) |
57
|
|
|
|
|
|
|
)->[0]; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |