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