File Coverage

lib/Data/Processor/PodWriter.pm
Criterion Covered Total %
statement 23 23 100.0
branch 7 8 87.5
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 34 36 94.4


line stmt bran cond sub pod time code
1 19     19   235 use 5.10.1;
  19         57  
2 19     19   97 use strict;
  19         32  
  19         371  
3 19     19   81 use warnings;
  19         34  
  19         4496  
4             package Data::Processor::PodWriter;
5              
6             # writes pod for a schema given.
7              
8             sub pod_write{
9 3     3 0 4 my $schema = shift;
10 3         4 my $pod_string = shift;
11 3         4 for my $key (sort keys %{$schema}){
  3         8  
12 4         6 $pod_string .= $key;
13             $pod_string .= " (optional)"
14 4 100       8 if $schema->{$key}->{optional};
15             $pod_string .= ": $schema->{$key}->{description}"
16 4 50       22 if $schema->{$key}->{description};
17             $pod_string .= "\n\nDefault value: $schema->{$key}->{default}"
18 4 100       11 if $schema->{$key}->{default};
19 4         5 $pod_string .= "\n\n";
20 4 100       9 if ($schema->{$key}->{members}){
21 2         4 $pod_string .= "$key has the following members:\n\n";
22 2         3 $pod_string .= "=over\n\n";
23 2         7 $pod_string .= pod_write($schema->{$key}->{members}, '');
24 2         5 $pod_string .= "=back\n\n";
25             }
26             }
27 3         7 return $pod_string;
28             }
29              
30             1