| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Evented::Configuration::Builder; | 
| 2 | 1 |  |  | 1 |  | 457 | use Module::Build; | 
|  | 1 |  |  |  |  | 58837 |  | 
|  | 1 |  |  |  |  | 242 |  | 
| 3 |  |  |  |  |  |  | @ISA = qw(Module::Build); | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | sub ACTION_distmeta { | 
| 6 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 7 | 0 | 0 |  |  |  |  | if (eval { require Pod::Markdown; 1 }) { | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 0 |  |  |  |  |  | $self->log_info("Creating README.md using Pod::Markdown\n"); | 
| 10 | 0 | 0 |  |  |  |  | open my $fh, '>', 'README.md' or return $self->SUPER::ACTION_distmeta(@_); | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 0 |  |  |  |  |  | my $p = Pod::Markdown->new; | 
| 13 | 0 |  |  |  |  |  | my $markdown; | 
| 14 | 0 |  |  |  |  |  | $p->output_string(\$markdown); | 
| 15 | 0 | 0 |  |  |  |  | $p->parse_file('lib/Evented/Configuration.pm') or return $self->SUPER::ACTION_distmeta(@_); | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 0 |  |  |  |  |  | my (@lines, $in_block); | 
| 18 | 0 |  |  |  |  |  | foreach my $line (split "\n", $markdown) { | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | # indented code. | 
| 21 | 0 | 0 |  |  |  |  | if (substr($line, 0, 4) eq '    ') { | 
| 22 | 0 |  |  |  |  |  | my $code = substr($line, 4, length($line) - 4); | 
| 23 | 0 | 0 |  |  |  |  | if ($in_block) { | 
| 24 | 0 |  |  |  |  |  | push @lines, $code; | 
| 25 | 0 |  |  |  |  |  | next; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 0 |  |  |  |  |  | push @lines, '````perl', $code; | 
| 29 | 0 |  |  |  |  |  | $in_block = 1; | 
| 30 | 0 |  |  |  |  |  | next; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | # not indented. | 
| 34 | 0 | 0 |  |  |  |  | if ($in_block) { | 
| 35 | 0 |  |  |  |  |  | push @lines, '```', $line; | 
| 36 | 0 |  |  |  |  |  | $in_block = 0; | 
| 37 | 0 |  |  |  |  |  | next; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 0 |  |  |  |  |  | push @lines, $line; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 0 |  |  |  |  |  | print $fh $_, "\n" foreach @lines; | 
| 44 | 0 |  |  |  |  |  | close $fh; | 
| 45 | 0 |  |  |  |  |  | $self->_add_to_manifest('MANIFEST', 'README.md'); | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  | else { | 
| 48 | 0 |  |  |  |  |  | $self->log_warn("Cannot create README.md; Pod::Markdown unavailable\n"); | 
| 49 |  |  |  |  |  |  | } | 
| 50 | 0 |  |  |  |  |  | return $self->SUPER::ACTION_distmeta(@_); | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | 1; |