| blib/lib/Dunce/time/Zerofill.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| statement | 16 | 16 | 100.0 |
| branch | 2 | 2 | 100.0 |
| condition | n/a | ||
| subroutine | 5 | 5 | 100.0 |
| pod | n/a | ||
| total | 23 | 23 | 100.0 |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package Dunce::time::Zerofill; | ||||||
| 2 | |||||||
| 3 | 2 | 2 | 13778 | use strict; | |||
| 2 | 5 | ||||||
| 2 | 69 | ||||||
| 4 | 2 | 2 | 10 | use vars qw($VERSION); | |||
| 2 | 3 | ||||||
| 2 | 159 | ||||||
| 5 | $VERSION = '0.02'; | ||||||
| 6 | |||||||
| 7 | sub import { | ||||||
| 8 | 2 | 2 | 14 | my($class, $digit) = @_; | |||
| 9 | 2 | 100 | 8 | $digit = 10 unless defined $digit; | |||
| 10 | 2 | 5 | my $caller = caller; | ||||
| 11 | { | ||||||
| 12 | 2 | 2 | 9 | no strict 'refs'; | |||
| 2 | 5 | ||||||
| 2 | 169 | ||||||
| 2 | 3 | ||||||
| 13 | 2 | 3580 | *{$caller.'::time'} = sub { | ||||
| 14 | 4 | 4 | 55 | return sprintf '%' . $digit . 'd', time; | |||
| 15 | 2 | 8 | }; | ||||
| 16 | } | ||||||
| 17 | } | ||||||
| 18 | |||||||
| 19 | 1; | ||||||
| 20 | |||||||
| 21 | __END__ |