blib/lib/Data/Encoder/Custom.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 13 | 13 | 100.0 |
branch | n/a | ||
condition | 1 | 2 | 50.0 |
subroutine | 5 | 5 | 100.0 |
pod | 0 | 3 | 0.0 |
total | 19 | 23 | 82.6 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Data::Encoder::Custom; | ||||||
2 | |||||||
3 | 1 | 1 | 683 | use strict; | |||
1 | 1 | ||||||
1 | 32 | ||||||
4 | 1 | 1 | 5 | use warnings; | |||
1 | 2 | ||||||
1 | 162 | ||||||
5 | |||||||
6 | sub new { | ||||||
7 | 1 | 1 | 0 | 561 | my ($class, $args) = @_; | ||
8 | 1 | 50 | 4 | $args ||= {}; | |||
9 | 1 | 5 | bless { %$args }, __PACKAGE__; | ||||
10 | } | ||||||
11 | |||||||
12 | sub encode { | ||||||
13 | 1 | 1 | 0 | 7 | my ($self, $stuff, @args) = @_; | ||
14 | 1 | 6 | $self->{encoder}->($stuff, @args); | ||||
15 | } | ||||||
16 | |||||||
17 | sub decode { | ||||||
18 | 1 | 1 | 0 | 313 | my ($self, $stuff, @args) = @_; | ||
19 | 1 | 4 | $self->{decoder}->($stuff, @args); | ||||
20 | } | ||||||
21 | |||||||
22 | 1; | ||||||
23 | __END__ |