StatsMix.pm

filter: Statementstmt 54.4% 97 / 178 Branchbran 42.0% 37 / 88 Conditioncond 17.8% 15 / 84 MC/DCmcdc 3.8% 2 / 52 Subroutinesub 82.7% 24 / 29 Podpod 100% 10 / 10 totaltotal 41.9% 185 / 441 SCAR 70.9
CC
77
Cov
43%
update_metric
110.4
get_metrics
107.9
get_stats
107.9
CRAP 1200.0
↑ Summary StatsMix/Params.pm »
1 package WWW::StatsMix;
2  
3 12 $WWW::StatsMix::VERSION = '0.05';
4  
5 =head1 NAME
6  
7 WWW::StatsMix - Interface to StatsMix API.
8  
9 =head1 VERSION
10  
11 Version 0.05
12  
13 =cut
14  
15 12 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 12 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 12 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 12 ▶use WWW::StatsMix::Stat;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 12 ▶use WWW::StatsMix::Metric;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 12 ▶use WWW::StatsMix::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 12 ▶use WWW::StatsMix::Params qw(validate);
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 12 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 12 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 12 extends 'WWW::StatsMix::UserAgent';
27  
28 11 ▶has format => (is => 'ro', default => sub { return 'json' });
Subroutine __ANON__: called CC=1 SCAR=0.0
29 11 ▶has metrics_url => (is => 'ro', default => sub { return 'http://api.statsmix.com/api/v2/metrics' });
Subroutine __ANON__: called CC=1 SCAR=0.0
30 11 ▶has stats_url => (is => 'ro', default => sub { return 'http://api.statsmix.com/api/v2/stats' });
Subroutine __ANON__: called CC=1 SCAR=0.0
31 11 ▶has track_url => (is => 'ro', default => sub { return 'http://api.statsmix.com/api/v2/track' });
Subroutine __ANON__: called CC=1 SCAR=0.0
32  
33 =head1 DESCRIPTION
34  
35 StatsMix provides an API that can be used to create, retrieve, update, and delete
36 metrics and stats resources. The API is built using RESTful principles.
37  
38 The current version is 2.0.
39  
40 To get an API key, you can sign up for a free Developer account L<here|http://www.statsmix.com/try?plan=developer>.
41  
42 If you go over the number of API requests available to your account, the API will
43 return a 403 Forbidden error and an explanation. The number of API requests and
44 profiles you can create is based on the type of account you have. For example,
45 Standard plans are limited to 300,000 API requests per month.
46  
47 =head1 SYNOPSIS
48  
49 Use Strict; use warnings;
50 use WWW::StatsMix;
51  
52 my $API_KEY = "Your API Key";
53 my $api = WWW::StatsMix->new(api_key => $API_KEY);
54  
55 my $metric_1 = $api->create_metric({ name => "Testing - 1" });
56 my $metric_2 = $api->create_metric({ name => "Testing - 2", include_in_email => 0 });
57 $api->update_metric($metric_2->id, { name => "Testing - 3", include_in_email => 1 });
58  
59 my $metrics = $api->get_metrics;
60 my $only_2 = $api->get_metrics({ limit => 2 });
61  
62 =head1 METHODS
63  
64 =head2 create_metric(\%params)
65  
66 It creates new metric and returns the object of type L<WWW::StatsMix::Metric>.The
67 possible parameters for the method are as below:
68  
69 +------------------+-----------------------------------------------------------------------+
70 | Key | Description |
71 +------------------+-----------------------------------------------------------------------+
72 | name | The name of the metric. Metric names must be unique within a profile. |
73 | (required) | |
74 | | |
75 | profile_id | The profile the metric belongs in. |
76 | (optional) | |
77 | | |
78 | sharing | Sharing status for the metric. Either "public" (unauthenticated users |
79 | (optional) | can view the metric at the specific URL) or "none" (default). |
80 | | |
81 | include_in_email | This specifies whether to include the metric in the daily |
82 | (optional) | StatsMix email sent to users. |
83 | | |
84 | url | Publicly accessible URL for the metric (only if sharing is set |
85 | (optional) | to "public"). |
86 +------------------+-----------------------------------------------------------------------+
87  
88 use strict; use warnings;
89 use WWW::StatsMix;
90  
91 my $API_KEY = "Your_API_Key";
92 my $api = WWW::StatsMix->new(api_key => $API_KEY);
93 my $metric = $api->create_metric({ name => "Testing API - 2" });
94  
95 print "Id: ", $metric->id, "\n";
96  
97 =cut
98  
99 sub create_metric {
100 11 ▶ my ($self, $params) = @_;
Subroutine create_metric: called CC=10 SCAR=30.6
Pod documented
101  
102 11 my $data = [
103 { key => 'name' , required => 1 },
104 { key => 'profile_id' , required => 0 },
105 { key => 'url' , required => 0 },
106 { key => 'sharing' , required => 0 },
107 { key => 'include_in_email' , required => 0 },
108 { key => 'format' , required => 0 },
109 ];
110 11 validate($data, $params);
111  
112 2 ▶ if (exists $params->{sharing}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i) 1 1 2
Condition66%4/6
exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i
!ll&&!rl&&r
101
exists $params->{"sharing"} and defined $params->{"sharing"}
!ll&&!rl&&r
101
MC/DC33%1/3
exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i
exists $params->{"sharing"} defined $params->{"sharing"} $params->{"sharing"} =~ /\bpublic\b/i
Truth table50%2/4
A and B and C
A= exists $params->{"sharing"}B= defined $params->{"sharing"}C= $params->{"sharing"} =~ /\bpublic\b/i
ABCresult
0XX0
10X0
1100
1111
113 && defined $params->{sharing}
114 && ($params->{sharing} =~ /\bpublic\b/i)) {
115 die "ERROR: Missing key 'url' since 'sharing' is provided."
116 1 ▶ unless (exists $params->{url});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"url"} 1 0 1
117 }
118 1 ▶ if (exists $params->{url} && defined $params->{url}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{"url"} and defined $params->{"url"}) 1 0 1
Condition33%1/3
exists $params->{"url"} and defined $params->{"url"}
!ll&&!rl&&r
001
MC/DC0%0/2
exists $params->{"url"} and defined $params->{"url"}
exists $params->{"url"} defined $params->{"url"}
Truth table33%1/3
A and B
A= exists $params->{"url"}B= defined $params->{"url"}
ABresult
0X0
100
111
119 die "ERROR: Missing key 'sharing' since 'url' is provided."
120 1 ▶ unless (exists $params->{sharing});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"sharing"} 1 0 1
121 }
122  
123 $params->{format} = $self->format
124 0 ▶ unless (exists $params->{format} && defined $params->{format});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"format"} and defined $params->{"format"} 0 0 0
Condition0%0/3
exists $params->{"format"} and defined $params->{"format"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"format"} and defined $params->{"format"}
exists $params->{"format"} defined $params->{"format"}
Truth table0%0/3
A and B
A= exists $params->{"format"}B= defined $params->{"format"}
ABresult
0X0
100
111
125  
126 0 my $response = $self->post($self->metrics_url, [ %$params ]);
127 0 my $content = from_json($response->content);
128  
129 0 return WWW::StatsMix::Metric->new($content->{metric});
130 }
131  
132 =head2 update_metric($metric_id, \%params)
133  
134 It updates the metric & returns the object of type L<WWW::StatsMix::Metric>. This
135 requires mandatory param 'metric_id' and atleast one of the following key as ref
136 to hash format data. Possible parameters are as below:
137  
138 +------------------+-----------------------------------------------------------------------+
139 | Key | Description |
140 +------------------+-----------------------------------------------------------------------+
141 | name | The name of the metric. Metric names must be unique within a profile. |
142 | | |
143 | sharing | Sharing status for the metric. Either "public" (unauthenticated users |
144 | | can view the metric at the specific URL) or "none" (default). |
145 | | |
146 | include_in_email | This specifies whether to include the metric in the daily |
147 | | StatsMix email sent to users. |
148 | | |
149 | url | Publicly accessible URL for the metric (only if sharing is set |
150 | | to "public"). |
151 +------------------+-----------------------------------------------------------------------+
152  
153 use strict; use warnings;
154 use WWW::StatsMix;
155  
156 my $API_KEY = "Your_API_Key";
157 my $api = WWW::StatsMix->new(api_key => $API_KEY);
158 my $metric_id = <your_metric_id>;
159 my $metric = $api->update_metric($metric_id, { name => "Testing API - new" });
160  
161 print "Name: ", $metric->name, "\n";
162  
163 =cut
164  
165 sub update_metric {
166 8 ▶ my ($self, $id, $params) = @_;
Subroutine update_metric: called CC=16 SCAR=47.0
Pod documented
167  
168 8 ▶ die "ERROR: Missing the required metric id." unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 7 8
169 7 ▶ die "ERROR: Invalid metric id [$id]." unless ($id =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $id =~ /^\d+$/ 1 6 7
170  
171 6 ▶ if (defined $params && ref($params) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params and ref $params eq 'HASH') { } 5 1 6
Condition66%2/3
defined $params and ref $params eq "HASH"
!ll&&!rl&&r
015
MC/DC50%1/2
defined $params and ref $params eq "HASH"
defined $params ref $params eq "HASH"
Truth table66%2/3
A and B
A= defined $paramsB= ref $params eq "HASH"
ABresult
0X0
100
111
172 5 my $data = [
173 { key => 'name' , required => 0 },
174 { key => 'url' , required => 0 },
175 { key => 'sharing' , required => 0 },
176 { key => 'include_in_email' , required => 0 },
177 ];
178  
179 5 validate($data, $params);
180  
181 0 ▶ die "ERROR: Missing keys to update." unless (scalar(keys %$params));
Branch: 1 branch
BranchTrueFalseTotal
unless scalar keys %$params 0 0 0
182  
183 0 ▶ if (exists $params->{sharing}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i) 0 0 0
Condition0%0/6
exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i
!ll&&!rl&&r
000
exists $params->{"sharing"} and defined $params->{"sharing"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i
exists $params->{"sharing"} defined $params->{"sharing"} $params->{"sharing"} =~ /\bpublic\b/i
Truth table0%0/4
A and B and C
A= exists $params->{"sharing"}B= defined $params->{"sharing"}C= $params->{"sharing"} =~ /\bpublic\b/i
ABCresult
0XX0
10X0
1100
1111
184 && defined $params->{sharing}
185 && ($params->{sharing} =~ /\bpublic\b/i)) {
186 die "ERROR: Invalid data for key 'url'."
187 0 ▶ unless (exists $params->{url} && defined $params->{url});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"url"} and defined $params->{"url"} 0 0 0
Condition0%0/3
exists $params->{"url"} and defined $params->{"url"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"url"} and defined $params->{"url"}
exists $params->{"url"} defined $params->{"url"}
Truth table0%0/3
A and B
A= exists $params->{"url"}B= defined $params->{"url"}
ABresult
0X0
100
111
188 }
189 0 ▶ if (exists $params->{url} && defined $params->{url}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{"url"} and defined $params->{"url"}) 0 0 0
Condition0%0/3
exists $params->{"url"} and defined $params->{"url"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"url"} and defined $params->{"url"}
exists $params->{"url"} defined $params->{"url"}
Truth table0%0/3
A and B
A= exists $params->{"url"}B= defined $params->{"url"}
ABresult
0X0
100
111
190 die "ERROR: Invalid data for key 'sharing'."
191 unless (exists $params->{sharing}
192 && defined $params->{sharing}
193 0 ▶ && ($params->{sharing} =~ /\bpublic\b/i));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i 0 0 0
Condition0%0/6
exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i
!ll&&!rl&&r
000
exists $params->{"sharing"} and defined $params->{"sharing"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $params->{"sharing"} and defined $params->{"sharing"} and $params->{"sharing"} =~ /\bpublic\b/i
exists $params->{"sharing"} defined $params->{"sharing"} $params->{"sharing"} =~ /\bpublic\b/i
Truth table0%0/4
A and B and C
A= exists $params->{"sharing"}B= defined $params->{"sharing"}C= $params->{"sharing"} =~ /\bpublic\b/i
ABCresult
0XX0
10X0
1100
1111
194 }
195 }
196 else {
197 1 die "ERROR: Parameters have to be hash ref.";
198 }
199  
200 0 my $url = sprintf("%s/%d.json", $self->metrics_url, $id);
201 0 my $response = $self->put($url, [ %$params ]);
202 0 my $content = from_json($response->content);
203  
204 0 return WWW::StatsMix::Metric->new($content->{metric});
205 }
206  
207 =head2 delete_metric($metric_id)
208  
209 It deletes the metric and returns the object of type L<WWW::StatsMix::Metric>. It
210 requires mandatory 'metric_id'.
211  
212 use strict; use warnings;
213 use WWW::StatsMix;
214  
215 my $API_KEY = "Your_API_Key";
216 my $api = WWW::StatsMix->new(api_key => $API_KEY);
217 my $metric_id = <your_metric_id>;
218 my $metric = $api->delete_metric($metric_id);
219  
220 print "Name: ", $metric->name, "\n";
221  
222 =cut
223  
224 sub delete_metric {
225 2 ▶ my ($self, $id) = @_;
Subroutine delete_metric: called CC=3 SCAR=13.5
Pod documented
226  
227 2 ▶ die "ERROR: Missing the required key metric id." unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 1 1 2
228 1 ▶ die "ERROR: Invalid the required key metric id [$id]." unless ($id =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $id =~ /^\d+$/ 1 0 1
229  
230 0 my $url = sprintf("%s/%d.json", $self->metrics_url, $id);
231 0 my $response = $self->delete($url);
232 0 my $content = from_json($response->content);
233  
234 0 return WWW::StatsMix::Metric->new($content->{metric});
235 }
236  
237 =head2 get_metrics(\%params)
238  
239 The method get_metrics() will return a default of up to 50 records. The parameter
240 limit can be passed to specify the number of records to return. The parameter
241 profile_id can also be used to scope records to a particular profile. Parameters
242 start_date & end_date can be used to limit the date range based on the timestamp
243 in a stat's generated_at.
244 The result of the call is reference to list of L<WWW::StatsMix::Metric> objects.
245  
246 +------------+---------------------------------------------------------------+
247 | Key | Description |
248 +------------+---------------------------------------------------------------+
249 | limit | Limit the number of metrics. Default is 50. |
250 | (optional) | |
251 | | |
252 | profile_id | Scope the search to a particular profile. |
253 | (optional) | |
254 | | |
255 | start_date | Limit the searh in date range against stats generated_at key. |
256 | / end_date | Valid format is YYYY-MM-DD. |
257 | (optional) | |
258 +------------+---------------------------------------------------------------+
259  
260 use strict; use warnings;
261 use WWW::StatsMix;
262  
263 my $API_KEY = "Your_API_Key";
264 my $api = WWW::StatsMix->new(api_key => $API_KEY);
265 my $profile_id = <your_profile_id>;
266 my $limit = <your_limit_count>;
267  
268 my $metrics_all = $api->get_metrics;
269 my $metrics_by_limit = $api->get_metrics({ limit => $limit });
270 my $metrics_by_profile = $api->get_metrics({ profile_id => $profile_id });
271  
272 =cut
273  
274 sub get_metrics {
275 7 ▶ my ($self, $params) = @_;
Subroutine get_metrics: called CC=15 SCAR=46.8
Pod documented
276  
277 7 my $url = sprintf("%s?format=%s", $self->metrics_url, $self->format);
278 7 ▶ if (defined $params) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params) 7 0 7
279 7 my $data = [
280 { key => 'limit' , required => 0 },
281 { key => 'profile_id', required => 0 },
282 { key => 'start_date', required => 0 },
283 { key => 'end_date' , required => 0 },
284 ];
285 7 validate($data, $params);
286  
287 1 ▶ if (exists $params->{start_date} && defined $params->{start_date}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $params->{'start_date'} and defined $params->{'start_date'}) { } 1 0 1
elsif (exists $params->{'end_date'} and defined $params->{'end_date'}) { } 0 0 0
Condition33%1/3
exists $params->{"start_date"} and defined $params->{"start_date"}
!ll&&!rl&&r
001
MC/DC0%0/2
exists $params->{"start_date"} and defined $params->{"start_date"}
exists $params->{"start_date"} defined $params->{"start_date"}
Truth table33%1/3
A and B
A= exists $params->{"start_date"}B= defined $params->{"start_date"}
ABresult
0X0
100
111
288 die "ERROR: Missing param key 'end_date'."
289 1 ▶ unless (exists $params->{end_date} && defined $params->{end_date});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"end_date"} and defined $params->{"end_date"} 1 0 1
Condition33%1/3
exists $params->{"end_date"} and defined $params->{"end_date"}
!ll&&!rl&&r
100
MC/DC0%0/2
exists $params->{"end_date"} and defined $params->{"end_date"}
exists $params->{"end_date"} defined $params->{"end_date"}
Truth table33%1/3
A and B
A= exists $params->{"end_date"}B= defined $params->{"end_date"}
ABresult
0X0
100
111
290 die "ERROR: Invalid param key 'start_date'."
291 0 ▶ unless _is_valid_date($params->{start_date});
Branch: 1 branch
BranchTrueFalseTotal
unless _is_valid_date($params->{"start_date"}) 0 0 0
292 die "ERROR: Invalid param key 'end_date'."
293 0 ▶ unless _is_valid_date($params->{end_date});
Branch: 1 branch
BranchTrueFalseTotal
unless _is_valid_date($params->{"end_date"}) 0 0 0
294 }
295 ▶ elsif (exists $params->{end_date} && defined $params->{end_date}) {
Condition0%0/3
exists $params->{"end_date"} and defined $params->{"end_date"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"end_date"} and defined $params->{"end_date"}
exists $params->{"end_date"} defined $params->{"end_date"}
Truth table0%0/3
A and B
A= exists $params->{"end_date"}B= defined $params->{"end_date"}
ABresult
0X0
100
111
296 die "ERROR: Missing param key 'start_date'."
297 0 ▶ unless (exists $params->{start_date} && defined $params->{start_date});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"start_date"} and defined $params->{"start_date"} 0 0 0
Condition0%0/3
exists $params->{"start_date"} and defined $params->{"start_date"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"start_date"} and defined $params->{"start_date"}
exists $params->{"start_date"} defined $params->{"start_date"}
Truth table0%0/3
A and B
A= exists $params->{"start_date"}B= defined $params->{"start_date"}
ABresult
0X0
100
111
298 }
299  
300 0 foreach (qw(limit profile_id start_date end_date)) {
301 0 ▶ if (exists $params->{$_} && defined $params->{$_}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{$_} and defined $params->{$_}) 0 0 0
Condition0%0/3
exists $params->{$_} and defined $params->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{$_} and defined $params->{$_}
exists $params->{$_} defined $params->{$_}
Truth table0%0/3
A and B
A= exists $params->{$_}B= defined $params->{$_}
ABresult
0X0
100
111
302 0 $url .= sprintf("&%s=%s", $_, $params->{$_});
303 }
304 }
305 }
306  
307 0 my $response = $self->get($url);
308 0 my $content = from_json($response->content);
309  
310 0 return _get_metrics($content);
311 }
312  
313 =head2 create_stat(\%params)
314  
315 The method create_stat() creates stat for the given metric. You can also create
316 stat with ref_id. It returns an object of type L<WWW::StatsMix::Stat>.
317  
318 +--------------+----------------------------------------------------------------------------+
319 | Key | Description |
320 +--------------+----------------------------------------------------------------------------+
321 | metric_id | The metric id for which the stat would be created. |
322 | (required) | |
323 | | |
324 | value | The numeric value of the stat with a decimal precision of two. Decimal (up |
325 | (required) | to 11 digits on the left side of the decimal point, two on the right). |
326 | | |
327 | generated_at | Datetime for the stat. If not set, defaults to the current timestamp. This |
328 | (optional) | is the datetime to be used in the charts. Valid format is YYYY-MM-DD. |
329 | | |
330 | meta | hash ref data (key,value pair) about anything associated with the stat. |
331 | (optional) | |
332 | | |
333 | ref_id | Optional reference id for a stat. If a stat already exists for the named |
334 | (optional) | metric and the given ref_id, the value (and optionally generated_at and |
335 | | meta) will be updated instead of created. |
336 | | |
337 +--------------+----------------------------------------------------------------------------+
338  
339 use strict; use warnings;
340 use WWW::StatsMix;
341  
342 my $API_KEY = "Your_API_Key";
343 my $api = WWW::StatsMix->new(api_key => $API_KEY);
344 my $metric_id = <your_metric_id>;
345 my $value = <your_new_stat_value>;
346 my $params = { metric_id => $metric_id, value => $value };
347 my $stat = $api->create_stat($params);
348  
349 print "Id: ", $stat->id, "\n";
350  
351 =cut
352  
353 sub create_stat {
354 12 ▶ my ($self, $params) = @_;
Subroutine create_stat: called CC=4 SCAR=18.5
Pod documented
355  
356 12 my $data = [
357 { key => 'metric_id' , required => 1 },
358 { key => 'value' , required => 1 },
359 { key => 'generated_at', required => 0 },
360 { key => 'meta' , required => 0 },
361 { key => 'ref_id' , required => 0 }
362 ];
363 12 validate($data, $params);
364  
365 2 ▶ if (exists $params->{meta} && defined $params->{meta}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{"meta"} and defined $params->{"meta"}) 2 0 2
Condition33%1/3
exists $params->{"meta"} and defined $params->{"meta"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $params->{"meta"} and defined $params->{"meta"}
exists $params->{"meta"} defined $params->{"meta"}
Truth table33%1/3
A and B
A= exists $params->{"meta"}B= defined $params->{"meta"}
ABresult
0X0
100
111
366 die "ERROR: Invalid data format for key 'meta'."
367 2 ▶ unless (ref($params->{meta}) eq 'HASH');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $params->{"meta"} eq "HASH" 2 0 2
368 0 $params->{meta} = to_json($params->{meta});
369 }
370  
371 0 $params->{format} = $self->format;
372 0 my $response = $self->post($self->stats_url, [ %$params ]);
373 0 my $content = from_json($response->content);
374  
375 0 return WWW::StatsMix::Stat->new($content->{stat});
376 }
377  
378 =head2 get_stat($metric_id, \%params)
379  
380 Returns the stat details of the given stat of the metric. The stat can be either
381 search by stat id or ref id. The return data is of type L<WWW::StatsMix::Stat>.It
382 requires mandatory key 'metric_id'. If both 'id' and 'ref_id' are defined then
383 'id' takes the precedence.
384  
385 +--------+------------------------------------------------------------------+
386 | Key | Description |
387 +--------+------------------------------------------------------------------+
388 | id | The stat id of the stat. Required only if 'ref_id' is undefined. |
389 | | |
390 | ref_id | Ref id of the stat. Required only if 'id' is undefined. |
391 +--------+------------------------------------------------------------------+
392  
393 use strict; use warnings;
394 use WWW::StatsMix;
395  
396 my $API_KEY = "Your_API_Key";
397 my $api = WWW::StatsMix->new(api_key => $API_KEY);
398 my $metric_id = <your_metric_id>;
399 my $stat_id = <your_metric_stat_id>;
400 my $stat_ref_id = <your_metric_stat_ref_id>;
401  
402 my $stat_by_id = $api->get_stat($metric_id, { id => $stat_id });
403 my $stat_by_ref_id = $api->get_stat($metric_id, { ref_id => $stat_ref_id });
404  
405 print "Stat by Id (name) : ", $stat_by_id->name, "\n";
406 print "Stat by Ref Id (name): ", $stat_by_ref_id->name, "\n";
407  
408 =cut
409  
410 sub get_stat {
411 8 ▶ my ($self, $metric, $params) = @_;
Subroutine get_stat: called CC=3 SCAR=12.3
Pod documented
412  
413 8 ▶ die "ERROR: Missing the required key metric id." unless defined $metric;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $metric 1 7 8
414 7 ▶ die "ERROR: Invalid the required key metric id [$metric]." unless ($metric =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $metric =~ /^\d+$/ 1 6 7
415  
416 6 my $data = [
417 { key => 'id' , required => 0 },
418 { key => 'ref_id', required => 0 }
419 ];
420 6 validate($data, $params);
421  
422 0 my $id = _get_id($params);
423 0 my $url = sprintf("%s/%d.json?metric_id=%d", $self->stats_url, $id, $metric);
424 0 my $response = $self->get($url);
425 0 my $content = from_json($response->content);
426  
427 0 return WWW::StatsMix::Stat->new($content->{stat});
428 }
429  
430 =head2 update_stat($metric_id, \%params)
431  
432 Update the stat of the metric.Stat can be located by stat id or ref id.Parameters
433 for the method are as below. The return data is of type L<WWW::StatsMix::Stat>.It
434 requires mandatory key 'metric_id' and params as hash ref. Following keys can be
435 passed in hash ref. If both 'id' and 'ref_id' are defined then 'id' takes the
436 precedence.
437  
438 +------------+----------------------------------------------------------------------------+
439 | Key | Description |
440 +------------+----------------------------------------------------------------------------+
441 | value | The numeric value of the stat with a decimal precision of two. Decimal (up |
442 | (required) | to 11 digits on the left side of the decimal point, two on the right). |
443 | | |
444 | id | The stat id of the stat. Required only if 'ref_id' is undefined. |
445 | | |
446 | ref_id | Ref id of the stat. Required only if 'id' is undefined. |
447 +------------+----------------------------------------------------------------------------+
448  
449 use strict; use warnings;
450 use WWW::StatsMix;
451  
452 my $API_KEY = "Your_API_Key";
453 my $api = WWW::StatsMix->new(api_key => $API_KEY);
454 my $metric_id = <your_metric_id>;
455 my $value = <your_stat_new_value>;
456 my $stat_id = <your_metric_stat_id>;
457 my $stat_ref_id = <your_metric_stat_ref_id>;
458  
459 my $stat_by_id = $api->update_stat($metric_id, { id => $stat_id, value => $value });
460 my $stat_by_ref_id = $api->update_stat($metric_id, { ref_id => $stat_ref_id, value => $value });
461  
462 print "Stat by Id (value) : ", $stat_by_id->value, "\n";
463 print "Stat by Ref Id (value): ", $stat_by_ref_id->value, "\n";
464  
465 =cut
466  
467 sub update_stat {
468 10 ▶ my ($self, $metric, $params) = @_;
Subroutine update_stat: called CC=3 SCAR=12.5
Pod documented
469  
470 10 ▶ die "ERROR: Missing the required key metric id." unless defined $metric;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $metric 1 9 10
471 9 ▶ die "ERROR: Invalid the required key metric id [$metric]." unless ($metric =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $metric =~ /^\d+$/ 1 8 9
472  
473 8 my $data = [
474 { key => 'value' , required => 1 },
475 { key => 'id' , required => 0 },
476 { key => 'ref_id', required => 0 }
477 ];
478 8 validate($data, $params);
479  
480 1 my $id = _get_id($params);
481 0 my $value = _get_value($params);
482 0 my $_data = { metric_id => $metric, value => $value };
483 0 my $url = sprintf("%s/%d.json", $self->stats_url, $id);
484 0 my $response = $self->put($url, [ %$_data ]);
485 0 my $content = from_json($response->content);
486  
487 0 return WWW::StatsMix::Stat->new($content->{stat});
488 }
489  
490 =head2 delete_stat($metric_id, \%params)
491  
492 Delete the stat of the metric.Stat can be located by stat id or ref id.Parameters
493 for the method are as below. The return data is of type L<WWW::StatsMix::Stat>.It
494 requires mandatory key 'metric_id' and params as hash ref. The hash ref can have
495 either 'id' or 'ref_id'. If both specified then 'id' takes the precedence.
496  
497 +--------+------------------------------------------------------------------+
498 | Key | Description |
499 +--------+------------------------------------------------------------------+
500 | id | The stat id of the stat. Required only if 'ref_id' is undefined. |
501 | | |
502 | ref_id | Ref id of the stat. Required only if 'id' is undefined. |
503 +--------+------------------------------------------------------------------+
504  
505 use strict; use warnings;
506 use WWW::StatsMix;
507  
508 my $API_KEY = "Your_API_Key";
509 my $api = WWW::StatsMix->new(api_key => $API_KEY);
510 my $metric_id = <your_metric_id>;
511 my $stat_id = <your_metric_stat_id>;
512 my $stat_ref_id = <your_metric_stat_ref_id>;
513  
514 my $stat_by_id = $api->delete_stat($metric_id, { id => $stat_id });
515 my $stat_by_ref_id = $api->delete_stat($metric_id, { ref_id => $stat_ref_id });
516  
517 =cut
518  
519 sub delete_stat {
520 9 ▶ my ($self, $metric, $params) = @_;
Subroutine delete_stat: called CC=3 SCAR=11.7
Pod documented
521  
522 9 ▶ die "ERROR: Missing the required key metric id." unless defined $metric;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $metric 1 8 9
523 8 ▶ die "ERROR: Invalid the required key metric id [$metric]." unless ($metric =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $metric =~ /^\d+$/ 1 7 8
524  
525 7 my $data = [
526 { key => 'id' , required => 0 },
527 { key => 'ref_id', required => 0 }
528 ];
529 7 validate($data, $params);
530  
531 1 my $id = _get_id($params);
532 0 my $url = sprintf("%s/%d.json?metric_id=%d", $self->stats_url, $id, $metric);
533 0 my $response = $self->delete($url);
534 0 my $content = from_json($response->content);
535  
536 0 return WWW::StatsMix::Stat->new($content->{stat});
537 }
538  
539 =head2 get_stats(\%params)
540  
541 The method get_stats() will return a default of up to 50 records. The parameter
542 limit can be passed to specify the number of records to return. The parameter
543 metric_id can also be used to scope records to a particular profile. Parameters
544 start_date & end_date can be used to limit the date range based on the timestamp
545 in a stat's generated_at.
546  
547 +------------+---------------------------------------------------------------+
548 | Key | Description |
549 +------------+---------------------------------------------------------------+
550 | limit | Limit the number of metrics. Default is 50. |
551 | (optional) | |
552 | | |
553 | metric_id | Scope the search to a particular metric. |
554 | (optional) | |
555 | | |
556 | start_date | Limit the searh in date range against stats generated_at key. |
557 | / end_date | Valid format is YYYY-MM-DD. |
558 | (optional) | |
559 +------------+---------------------------------------------------------------+
560  
561 use strict; use warnings;
562 use WWW::StatsMix;
563  
564 my $API_KEY = "Your_API_Key";
565 my $api = WWW::StatsMix->new(api_key => $API_KEY);
566 my $metric_id = <your_metric_id>;
567 my $limit = <your_limit_count>;
568  
569 my $stats = $api->get_stats();
570 my $stats_by_metric = $api->get_stats({ metric_id => $metric_id });
571 my $stats_by_metric_by_limit = $api->get_stats({ metric_id => $metric_id, limit => $limit });
572  
573 =cut
574  
575 sub get_stats {
576 7 ▶ my ($self, $params) = @_;
Subroutine get_stats: called CC=15 SCAR=46.8
Pod documented
577  
578 7 my $url = sprintf("%s?format=%s", $self->stats_url, $self->format);
579 7 ▶ if (defined $params) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params) 7 0 7
580 7 my $data = [
581 { key => 'limit' , required => 0 },
582 { key => 'metric_id' , required => 0 },
583 { key => 'start_date', required => 0 },
584 { key => 'end_date' , required => 0 },
585 ];
586 7 validate($data, $params);
587  
588 1 ▶ if (exists $params->{start_date} && defined $params->{start_date}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $params->{'start_date'} and defined $params->{'start_date'}) { } 1 0 1
elsif (exists $params->{'end_date'} and defined $params->{'end_date'}) { } 0 0 0
Condition33%1/3
exists $params->{"start_date"} and defined $params->{"start_date"}
!ll&&!rl&&r
001
MC/DC0%0/2
exists $params->{"start_date"} and defined $params->{"start_date"}
exists $params->{"start_date"} defined $params->{"start_date"}
Truth table33%1/3
A and B
A= exists $params->{"start_date"}B= defined $params->{"start_date"}
ABresult
0X0
100
111
589 die "ERROR: Missing param key 'end_date'."
590 1 ▶ unless (exists $params->{end_date} && defined $params->{end_date});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"end_date"} and defined $params->{"end_date"} 1 0 1
Condition33%1/3
exists $params->{"end_date"} and defined $params->{"end_date"}
!ll&&!rl&&r
100
MC/DC0%0/2
exists $params->{"end_date"} and defined $params->{"end_date"}
exists $params->{"end_date"} defined $params->{"end_date"}
Truth table33%1/3
A and B
A= exists $params->{"end_date"}B= defined $params->{"end_date"}
ABresult
0X0
100
111
591 die "ERROR: Invalid param key 'start_date'."
592 0 ▶ unless _is_valid_date($params->{start_date});
Branch: 1 branch
BranchTrueFalseTotal
unless _is_valid_date($params->{"start_date"}) 0 0 0
593 die "ERROR: Invalid param key 'end_date'."
594 0 ▶ unless _is_valid_date($params->{end_date});
Branch: 1 branch
BranchTrueFalseTotal
unless _is_valid_date($params->{"end_date"}) 0 0 0
595 }
596 ▶ elsif (exists $params->{end_date} && defined $params->{end_date}) {
Condition0%0/3
exists $params->{"end_date"} and defined $params->{"end_date"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"end_date"} and defined $params->{"end_date"}
exists $params->{"end_date"} defined $params->{"end_date"}
Truth table0%0/3
A and B
A= exists $params->{"end_date"}B= defined $params->{"end_date"}
ABresult
0X0
100
111
597 die "ERROR: Missing param key 'start_date'."
598 0 ▶ unless (exists $params->{start_date} && defined $params->{start_date});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"start_date"} and defined $params->{"start_date"} 0 0 0
Condition0%0/3
exists $params->{"start_date"} and defined $params->{"start_date"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"start_date"} and defined $params->{"start_date"}
exists $params->{"start_date"} defined $params->{"start_date"}
Truth table0%0/3
A and B
A= exists $params->{"start_date"}B= defined $params->{"start_date"}
ABresult
0X0
100
111
599 }
600  
601 0 foreach (qw(limit metric_id start_date end_date)) {
602 0 ▶ if (exists $params->{$_} && defined $params->{$_}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{$_} and defined $params->{$_}) 0 0 0
Condition0%0/3
exists $params->{$_} and defined $params->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{$_} and defined $params->{$_}
exists $params->{$_} defined $params->{$_}
Truth table0%0/3
A and B
A= exists $params->{$_}B= defined $params->{$_}
ABresult
0X0
100
111
603 0 $url .= sprintf("&%s=%s", $_, $params->{$_});
604 }
605 }
606 }
607  
608 0 my $response = $self->get($url);
609 0 my $content = from_json($response->content);
610  
611 0 return _get_stats($content);
612 }
613  
614 =head2 track(\%params)
615  
616 It combines the functions create_stat() and create_metric() (if necessary) into a
617 single method call. If no value is passed, the default of 1 is returned. Returns
618 an object of type L<WWW::StatsMix::Stat>.
619  
620 +--------------+----------------------------------------------------------------------------+
621 | Key | Description |
622 +--------------+----------------------------------------------------------------------------+
623 | name | The name of the metric you are tracking. If a metric with that name does |
624 | (required) | not exist in your account, one will be created automatically. |
625 | | |
626 | value | The numeric value of the stat with a decimal precision of two. Decimal (up |
627 | (optional) | to 11 digits on the left side of the decimal point, two on the right). If |
628 | | missing default value 1 is assigned. |
629 | | |
630 | generated_at | Datetime for the stat. If not set, defaults to the current timestamp. This |
631 | (optional) | is the datetime to be used in the charts. Valid format is YYYY-MM-DD. |
632 | | |
633 | meta | hashref data (key,value pair) about anything associated with the stat. |
634 | (optional) | |
635 | | |
636 | ref_id | Optional reference id for a stat. If a stat already exists for the named |
637 | (optional) | metric and the given ref_id, the value (and optionally generated_at and |
638 | | meta) will be updated instead of created. |
639 | | |
640 | profile_id | The unique id of the profile this stat belongs to. If not set, the metric |
641 | (optional) | will use the first profile_id created in your account. (Developer, Basic, |
642 | | and Standard plans only have one profile.) |
643 +--------------+----------------------------------------------------------------------------+
644  
645 use strict; use warnings;
646 use WWW::StatsMix;
647  
648 my $API_KEY = "Your_API_Key";
649 my $api = WWW::StatsMix->new(api_key => $API_KEY);
650 my $name = <your_metric_name>;
651 my $params = { name => $metric_name };
652 my $stat = $api->track($params);
653  
654 print "Id: ", $stat->id, "\n";
655  
656 =cut
657  
658 sub track {
659 8 ▶ my ($self, $params) = @_;
Subroutine track: called CC=3 SCAR=19.6
Pod documented
660  
661 8 my $data = [
662 { key => 'name' , required => 1 },
663 { key => 'value' , required => 0 },
664 { key => 'generated_at', required => 0 },
665 { key => 'meta' , required => 0 },
666 { key => 'ref_id' , required => 0 },
667 { key => 'profile_id' , required => 0 }
668 ];
669 8 validate($data, $params);
670  
671 $params->{meta} = to_json($params->{meta})
672 0 ▶ if (exists $params->{meta} && defined $params->{meta});
Branch: 1 branch
BranchTrueFalseTotal
if exists $params->{"meta"} and defined $params->{"meta"} 0 0 0
Condition0%0/3
exists $params->{"meta"} and defined $params->{"meta"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"meta"} and defined $params->{"meta"}
exists $params->{"meta"} defined $params->{"meta"}
Truth table0%0/3
A and B
A= exists $params->{"meta"}B= defined $params->{"meta"}
ABresult
0X0
100
111
673  
674 0 $params->{format} = $self->format;
675 0 my $response = $self->post($self->track_url, [ %$params ]);
676 0 my $content = from_json($response->content);
677  
678 0 return WWW::StatsMix::Stat->new($content->{stat});
679 }
680  
681 # PRIVATE METHODS
682 #
683 #
684  
685 sub _get_id {
686 2 ▶ my ($params) = @_;
Subroutine _get_id: called CC=7 SCAR=26.4
687  
688 2 ▶ if (defined $params && (ref($params) eq 'HASH')) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $params and ref $params eq "HASH") 2 0 2
Condition33%1/3
defined $params and ref $params eq "HASH"
!ll&&!rl&&r
002
MC/DC0%0/2
defined $params and ref $params eq "HASH"
defined $params ref $params eq "HASH"
Truth table33%1/3
A and B
A= defined $paramsB= ref $params eq "HASH"
ABresult
0X0
100
111
689 2 ▶ if (exists $params->{id} && defined $params->{id}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $params->{'id'} and defined $params->{'id'}) { } 0 2 2
elsif (exists $params->{'ref_id'} and defined $params->{'ref_id'}) { } 0 4 4
Condition33%1/3
exists $params->{"id"} and defined $params->{"id"}
!ll&&!rl&&r
200
MC/DC0%0/2
exists $params->{"id"} and defined $params->{"id"}
exists $params->{"id"} defined $params->{"id"}
Truth table33%1/3
A and B
A= exists $params->{"id"}B= defined $params->{"id"}
ABresult
0X0
100
111
690 0 return $params->{id};
691 }
692 ▶ elsif (exists $params->{ref_id} && defined $params->{ref_id}) {
Condition33%1/3
exists $params->{"ref_id"} and defined $params->{"ref_id"}
!ll&&!rl&&r
200
MC/DC0%0/2
exists $params->{"ref_id"} and defined $params->{"ref_id"}
exists $params->{"ref_id"} defined $params->{"ref_id"}
Truth table33%1/3
A and B
A= exists $params->{"ref_id"}B= defined $params->{"ref_id"}
ABresult
0X0
100
111
693 0 return $params->{ref_id};
694 }
695 }
696  
697 2 die "ERROR: Missing required key id/ref_id";
698 }
699  
700 sub _get_value {
701 0 ▶ my ($params) = @_;
Subroutine _get_value: not called CC=4 SCAR=30.0
702  
703 return $params->{value}
704 0 ▶ if (defined $params && exists $params->{value} && defined $params->{value});
Branch: 1 branch
BranchTrueFalseTotal
if defined $params and exists $params->{"value"} and defined $params->{"value"} 0 0 0
Condition0%0/6
defined $params and exists $params->{"value"} and defined $params->{"value"}
!ll&&!rl&&r
000
defined $params and exists $params->{"value"}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $params and exists $params->{"value"} and defined $params->{"value"}
defined $params exists $params->{"value"} defined $params->{"value"}
Truth table0%0/4
A and B and C
A= defined $paramsB= exists $params->{"value"}C= defined $params->{"value"}
ABCresult
0XX0
10X0
1100
1111
705  
706 0 die "ERROR: Missing required key 'value'.";
707 }
708  
709 sub _get_metrics {
710 0 ▶ my ($content) = @_;
Subroutine _get_metrics: not called CC=2 SCAR=17.9
711  
712 0 my $metrics = [];
713 0 foreach (@{$content->{metrics}->{metric}}) {
714 0 push @$metrics, WWW::StatsMix::Metric->new($_);
715 }
716  
717 0 return $metrics;
718 }
719  
720 sub _get_stats {
721 0 ▶ my ($content) = @_;
Subroutine _get_stats: not called CC=2 SCAR=17.9
722  
723 0 my $stats = [];
724 0 foreach (@{$content->{stats}->{stat}}) {
725 0 push @$stats, WWW::StatsMix::Stat->new($_);
726 }
727  
728 0 return $stats;
729 }
730  
731 sub _now_yyyy_mm_dd_hh_mi_ss {
732 0 ▶ my ($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
Subroutine _now_yyyy_mm_dd_hh_mi_ss: not called CC=1 SCAR=6.9
733 0 return sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year+=1900, ++$mon, $mday, $hour, $min, $sec);
734 }
735  
736 sub _now_yyyy_mm_dd {
737 0 ▶ my ($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
Subroutine _now_yyyy_mm_dd: not called CC=1 SCAR=6.9
738 0 return sprintf("%04d-%02d-%02d", $year+=1900, ++$mon, $mday);
739 }
740  
741 =head1 AUTHOR
742  
743 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
744  
745 =head1 REPOSITORY
746  
747 L<https://github.com/Manwar/WWW-StatsMix>
748  
749 =head1 BUGS
750  
751 Please report any bugs or feature requests to C<bug-www-statsmix at rt.cpan.org>,
752 or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-StatsMix>.
753 I will be notified, and then you'll automatically be notified of progress on your
754 bug as I make changes.
755  
756 =head1 SUPPORT
757  
758 You can find documentation for this module with the perldoc command.
759  
760 perldoc WWW::StatsMix
761  
762 You can also look for information at:
763  
764 =over 4
765  
766 =item * RT: CPAN's request tracker (report bugs here)
767  
768 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-StatsMix>
769  
770 =item * AnnoCPAN: Annotated CPAN documentation
771  
772 L<http://annocpan.org/dist/WWW-StatsMix>
773  
774 =item * CPAN Ratings
775  
776 L<http://cpanratings.perl.org/d/WWW-StatsMix>
777  
778 =item * Search CPAN
779  
780 L<http://search.cpan.org/dist/WWW-StatsMix/>
781  
782 =back
783  
784 =head1 LICENSE AND COPYRIGHT
785  
786 Copyright (C) 2014 - 2015 Mohammad S Anwar.
787  
788 This program is free software; you can redistribute it and/or modify it under
789 the terms of the the Artistic License (2.0). You may obtain a copy of the full
790 license at:
791  
792 L<http://www.perlfoundation.org/artistic_license_2_0>
793  
794 Any use, modification, and distribution of the Standard or Modified Versions is
795 governed by this Artistic License.By using, modifying or distributing the Package,
796 you accept this license. Do not use, modify, or distribute the Package, if you do
797 not accept this license.
798  
799 If your Modified Version has been derived from a Modified Version made by someone
800 other than you,you are nevertheless required to ensure that your Modified Version
801 complies with the requirements of this license.
802  
803 This license does not grant you the right to use any trademark, service mark,
804 tradename, or logo of the Copyright Holder.
805  
806 This license includes the non-exclusive, worldwide, free-of-charge patent license
807 to make, have made, use, offer to sell, sell, import and otherwise transfer the
808 Package with respect to any patent claims licensable by the Copyright Holder that
809 are necessarily infringed by the Package. If you institute patent litigation
810 (including a cross-claim or counterclaim) against any party alleging that the
811 Package constitutes direct or contributory patent infringement,then this Artistic
812 License to you shall terminate on the date that such litigation is filed.
813  
814 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
815 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
816 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
817 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
818 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
819 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
820 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
821  
822 =cut
823  
824 12 1; # End of WWW::StatsMix
↑ Summary StatsMix/Params.pm »