| 1 | 8 | ▶ | use v5.20.0; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 2 | 8 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | package Module::Faker::Heavy 0.027; | ||||||||||||
| 4 | # ABSTRACT: where the fake sausage gets made | ||||||||||||
| 5 | |||||||||||||
| 6 | 8 | ▶ | use Carp (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 8 | ▶ | use Text::Template; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 8 | my $template; | |||||||||||
| 10 | 42 | ▶ | sub _template { | ||||||||||
|
Subroutine
_template: called CC=7 SCAR=19.5
| |||||||||||||
| 11 | 42 | ▶ | return $template if $template; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 12 | |||||||||||||
| 13 | 8 | my $current; | |||||||||||
| 14 | 8 | ▶ | while (my $line = <DATA>) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 15 | 312 | chomp $line; | |||||||||||
| 16 | 312 | ▶ | if ($line =~ /\A__([^_]+)__\z/) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 24 | my $filename = $1; | |||||||||||
| 18 | 24 | ▶ | if ($filename !~ /\A(?:DATA|END)\z/) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 19 | 24 | $current = $filename; | |||||||||||
| 20 | 24 | next; | |||||||||||
| 21 | } | ||||||||||||
| 22 | } | ||||||||||||
| 23 | |||||||||||||
| 24 | 288 | ▶ | Carp::confess "bogus data section: text outside of file" unless $current; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | |||||||||||||
| 26 | 288 | ▶ | ($template->{$current} ||= '') .= "$line\n"; | ||||||||||
|
Condition100%2/2
$template->{$current} ||= ""
MC/DC100%1/1
$template->{$current} ||= ""
$template->{$current}
Truth table100%2/2
A
A= $template->{$current}
| |||||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | 8 | return $template; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 42 | ▶ | sub _render { | ||||||||||
|
Subroutine
_render: called CC=2 SCAR=7.0
| |||||||||||||
| 33 | 42 | my ($self, $name, $stash) = @_; | |||||||||||
| 34 | |||||||||||||
| 35 | Carp::confess "no file template for $name" unless | ||||||||||||
| 36 | 42 | ▶ | my $template = $self->_template->{ $name }; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | |||||||||||||
| 38 | my $text = Text::Template->fill_this_in( | ||||||||||||
| 39 | $template, | ||||||||||||
| 40 | DELIMITERS => [ '{{', '}}' ], | ||||||||||||
| 41 | 42 | HASH => { map {; $_ => \($stash->{$_}) } keys %$stash }, | |||||||||||
| 42 | ); | ||||||||||||
| 43 | |||||||||||||
| 44 | 42 | return $text; | |||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 8 | 1; | |||||||||||
| 48 | |||||||||||||
| 49 | =pod | ||||||||||||
| 50 | |||||||||||||
| 51 | =encoding UTF-8 | ||||||||||||
| 52 | |||||||||||||
| 53 | =head1 NAME | ||||||||||||
| 54 | |||||||||||||
| 55 | Module::Faker::Heavy - where the fake sausage gets made | ||||||||||||
| 56 | |||||||||||||
| 57 | =head1 VERSION | ||||||||||||
| 58 | |||||||||||||
| 59 | version 0.027 | ||||||||||||
| 60 | |||||||||||||
| 61 | =head1 PERL VERSION | ||||||||||||
| 62 | |||||||||||||
| 63 | This module should work on any version of perl still receiving updates from | ||||||||||||
| 64 | the Perl 5 Porters. This means it should work on any version of perl | ||||||||||||
| 65 | released in the last two to three years. (That is, if the most recently | ||||||||||||
| 66 | released version is v5.40, then this module should work on both v5.40 and | ||||||||||||
| 67 | v5.38.) | ||||||||||||
| 68 | |||||||||||||
| 69 | Although it may work on older versions of perl, no guarantee is made that the | ||||||||||||
| 70 | minimum required version will not be increased. The version may be increased | ||||||||||||
| 71 | for any reason, and there is no promise that patches will be accepted to | ||||||||||||
| 72 | lower the minimum required perl. | ||||||||||||
| 73 | |||||||||||||
| 74 | =head1 AUTHOR | ||||||||||||
| 75 | |||||||||||||
| 76 | Ricardo Signes <cpan@semiotic.systems> | ||||||||||||
| 77 | |||||||||||||
| 78 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 79 | |||||||||||||
| 80 | This software is copyright (c) 2008 by Ricardo Signes. | ||||||||||||
| 81 | |||||||||||||
| 82 | This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 83 | the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 84 | |||||||||||||
| 85 | =cut | ||||||||||||
| 86 | |||||||||||||
| 87 | __DATA__ | ||||||||||||