| blib/lib/WWW/NHKProgram/API/Date.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| statement | 16 | 16 | 100.0 |
| branch | 2 | 2 | 100.0 |
| condition | n/a | ||
| subroutine | 5 | 5 | 100.0 |
| pod | 0 | 1 | 0.0 |
| total | 23 | 24 | 95.8 |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package WWW::NHKProgram::API::Date; | ||||||
| 2 | 2 | 2 | 2624 | use strict; | |||
| 2 | 5 | ||||||
| 2 | 57 | ||||||
| 3 | 2 | 2 | 10 | use warnings; | |||
| 2 | 3 | ||||||
| 2 | 45 | ||||||
| 4 | 2 | 2 | 8 | use utf8; | |||
| 2 | 3 | ||||||
| 2 | 10 | ||||||
| 5 | 2 | 2 | 37 | use Carp; | |||
| 2 | 3 | ||||||
| 2 | 333 | ||||||
| 6 | |||||||
| 7 | sub validate { | ||||||
| 8 | 5 | 5 | 0 | 1635 | my $date = shift; | ||
| 9 | 5 | 100 | 16 | if ($date !~ /\A\d{4}-\d{2}-\d{2}\Z/) { | |||
| 10 | 4 | 416 | croak "Date must be hyphen separated. (e.g. 2014-02-14)"; | ||||
| 11 | } | ||||||
| 12 | 1 | 6 | return $date; | ||||
| 13 | } | ||||||
| 14 | |||||||
| 15 | 1; | ||||||
| 16 |