| 1 | package App::QuoteCC::Output::Lua; | ||
| 2 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | $App::QuoteCC::Output::Lua::AUTHORITY = 'cpan:AVAR'; | |
| 4 | } | ||
| 5 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | $App::QuoteCC::Output::Lua::VERSION = '0.10'; | |
| 7 | } | ||
| 8 | |||
| 9 | 1 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | ▶ | use Template; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 1 | ▶ | use Data::Section qw/ -setup /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use namespace::clean -except => [ qw/ meta merged_section_data section_data / ]; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 1 | with qw/ App::QuoteCC::Role::Output /; | |
| 18 | |||
| 19 | 1 | has template => ( | |
| 20 | isa => 'Str', | ||
| 21 | is => 'ro', | ||
| 22 | lazy_build => 1, | ||
| 23 | documentation => "The Template template to emit", | ||
| 24 | ); | ||
| 25 | |||
| 26 | 0 | ▶ | sub _build_template { |
|
Subroutine
_build_template: not called CC=1 SCAR=6.9
| |||
| 27 | 0 | my ($self) = @_; | |
| 28 | 0 | my $template = $self->section_data( 'program' ); | |
| 29 | 0 | return $$template; | |
| 30 | } | ||
| 31 | |||
| 32 | 0 | ▶ | sub output { |
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 33 | 0 | my ($self) = @_; | |
| 34 | 0 | my $handle = $self->file_handle; | |
| 35 | |||
| 36 | # Get output | ||
| 37 | 0 | my $out = $self->_process_template; | |
| 38 | |||
| 39 | # Spew output | ||
| 40 | 0 | $self->spew_output($out); | |
| 41 | |||
| 42 | 0 | return; | |
| 43 | } | ||
| 44 | |||
| 45 | 0 | ▶ | sub _process_template { |
|
Subroutine
_process_template: not called CC=1 SCAR=6.9
| |||
| 46 | 0 | my ($self) = @_; | |
| 47 | 0 | my $quotes = $self->quotes; | |
| 48 | 0 | my $template = $self->template; | |
| 49 | 0 | my $out; | |
| 50 | |||
| 51 | Template->new->process( | ||
| 52 | \$template, | ||
| 53 | { | ||
| 54 | quotes => $quotes, | ||
| 55 | size => scalar(@$quotes), | ||
| 56 | 0 | ▶ | escape => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 57 | 0 | my $text = shift; | |
| 58 | 0 | return "[===[$text]===]"; | |
| 59 | }, | ||
| 60 | }, | ||
| 61 | 0 | \$out | |
| 62 | ); | ||
| 63 | |||
| 64 | 0 | return $out; | |
| 65 | } | ||
| 66 | |||
| 67 | 1 | __PACKAGE__->meta->make_immutable; | |
| 68 | |||
| 69 | =encoding utf8 | ||
| 70 | |||
| 71 | =head1 NAME | ||
| 72 | |||
| 73 | App::QuoteCC::Output::Lua - Emit quotes in Lua format | ||
| 74 | |||
| 75 | =head1 AUTHOR | ||
| 76 | |||
| 77 | E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avar@cpan.org> | ||
| 78 | |||
| 79 | =head1 LICENSE AND COPYRIGHT | ||
| 80 | |||
| 81 | Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avar@cpan.org> | ||
| 82 | |||
| 83 | Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson <hinrik.sig@gmail.com> | ||
| 84 | |||
| 85 | This program is free software, you can redistribute it and/or modify | ||
| 86 | it under the same terms as Perl itself. | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | __DATA__ | ||