blib/lib/Defined/KV.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 10 | 10 | 100.0 |
branch | 2 | 2 | 100.0 |
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | 0 | 1 | 0.0 |
total | 16 | 17 | 94.1 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Defined::KV; | ||||||
2 | $Defined::KV::VERSION = '0.001'; | ||||||
3 | # ABSTRACT: Create a KV pair, but only if the value is defined | ||||||
4 | |||||||
5 | 2 | 2 | 71643 | use warnings; | |||
2 | 11 | ||||||
2 | 73 | ||||||
6 | 2 | 2 | 12 | use strict; | |||
2 | 4 | ||||||
2 | 50 | ||||||
7 | |||||||
8 | 2 | 2 | 12 | use Exporter 'import'; | |||
2 | 5 | ||||||
2 | 169 | ||||||
9 | our @EXPORT = qw(defined_kv); | ||||||
10 | |||||||
11 | sub defined_kv ($$) { | ||||||
12 | 3 | 100 | 3 | 0 | 94 | return (defined $_[1] ? @_[0,1] : ()); | |
13 | } | ||||||
14 | |||||||
15 | 1; | ||||||
16 | |||||||
17 | __END__ |