line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Kitko::Charts; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
45695
|
use 5.006; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
127
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
5
|
2
|
|
|
2
|
|
18
|
use warnings; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
759
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=encoding UTF-8 |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Finance::Kitko::Charts - Retrieve URLs for gold and silver quotes. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.01 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Finance::Kitko::Charts; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $charts = Finance::Kitko::Charts->new(); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# all share the same API, see bellow |
28
|
|
|
|
|
|
|
$data = $charts->gold(); |
29
|
|
|
|
|
|
|
$data = $charts->silver(); |
30
|
|
|
|
|
|
|
$data = $charts->platinum(); |
31
|
|
|
|
|
|
|
$data = $charts->palladium(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 USAGE |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Call the method, receive a hash table reference. Keys for different |
36
|
|
|
|
|
|
|
views ('24h' for 24 hour comparison, 'ny' for New York chart, '30d' |
37
|
|
|
|
|
|
|
for a month, '60d' for two months, '6m' for six months, '1y' for one |
38
|
|
|
|
|
|
|
year and '5y' for five years. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 AVAILABLE METHODS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 new |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Returns a new Finance::Kitko::Charts object. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
1
|
|
|
1
|
1
|
11
|
my $c = shift; |
50
|
1
|
|
|
|
|
3
|
return bless {}, $c; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 gold |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub gold { |
58
|
1
|
|
|
1
|
1
|
6
|
my ($self, %opts) = @_; |
59
|
1
|
|
|
|
|
6
|
$self->_fetch( gold => %opts ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 silver |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub silver { |
67
|
1
|
|
|
1
|
1
|
1210
|
my ($self, %opts) = @_; |
68
|
1
|
|
|
|
|
3
|
$self->_fetch( silver => %opts ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 platinum |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub platinum { |
76
|
0
|
|
|
0
|
1
|
0
|
my ($self, %opts) = @_; |
77
|
0
|
|
|
|
|
0
|
$self->_fetch( platinum => %opts ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 palladium |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub palladium { |
86
|
0
|
|
|
0
|
1
|
0
|
my ($self, %opts) = @_; |
87
|
0
|
|
|
|
|
0
|
$self->_fetch( palladium => %opts ); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _fetch { |
91
|
2
|
|
|
2
|
|
4
|
my ($self, $metal, %opts) = @_; |
92
|
|
|
|
|
|
|
|
93
|
2
|
|
|
|
|
8
|
my %symb = qw(silver ag gold au platinum pt palladium pd); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
return { |
96
|
2
|
|
|
|
|
30
|
'24h' => sprintf("http://www.kitco.com/images/live/%sw.gif", $metal), |
97
|
|
|
|
|
|
|
'ny' => sprintf("http://www.kitco.com/images/live/ny%sw.gif", $metal), |
98
|
|
|
|
|
|
|
'30d' => sprintf("http://www.kitco.com/LFgif/%s0030lnb.gif", $symb{$metal}), |
99
|
|
|
|
|
|
|
'60d' => sprintf("http://www.kitco.com/LFgif/%s0060lnb.gif", $symb{$metal}), |
100
|
|
|
|
|
|
|
'6m' => sprintf("http://www.kitco.com/LFgif/%s0182nyb.gif", $symb{$metal}), |
101
|
|
|
|
|
|
|
'1y' => sprintf("http://www.kitco.com/LFgif/%s0365nyb.gif", $symb{$metal}), |
102
|
|
|
|
|
|
|
'5y' => sprintf("http://www.kitco.com/LFgif/%s1825nyb.gif", $symb{$metal}) |
103
|
|
|
|
|
|
|
}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Alberto Simões, C<< >> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 BUGS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
113
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
114
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SUPPORT |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
perldoc Finance::Kitko::Charts |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
You can also look for information at: |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=over 4 |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * CPAN Ratings |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * Search CPAN |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=back |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Copyright 2012 Alberto Simões. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
157
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
158
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
1; # End of Finance::Kitko::Charts |