| 1 | package Templ::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp qw(cluck croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | my $PKG = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | eval { require Perl::Tidy; require File::Temp }; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | my $can_tidy = $@ ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | eval { require v5.10; }; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | my $can_say = $@ ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=20.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | if ( not defined $class || ref $class || $class !~ m/^(\w+\:\:)*\w+$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $class or ref $class or not $class =~ /^(\w+\:\:)*\w+$/
defined $class or ref $class
MC/DC0%0/3
defined $class or ref $class or not $class =~ /^(\w+\:\:)*\w+$/
defined $class
ref $class
not $class =~ /^(\w+\:\:)*\w+$/
Truth table25%1/4
A or B or not(C)
A= defined $classB= ref $classC= not $class =~ /^(\w+\:\:)*\w+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | croak "Can only be called as Templ::Parser::...->new"; | |||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | if ($class eq $PKG) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | croak "$PKG cannot be instantiated directly, use a subclass"; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 5 | my $self = bless {@_}, $class; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | sub parse { | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=11 SCAR=34.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | my $templ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # The template is assumed to be starting as printing output, so | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # wrap the whole template in a header/footer, escaping the contents | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | my $perl = ''; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | if ($self->prettify) { $perl .= $self->pretty_header; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | my $quoted = $templ->templ_code; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | $quoted =~ s|\\|\\\\|gs; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | $quoted =~ s|'|\\'|gs; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | $perl .= $templ->header; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | $perl .= $self->header; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 5 | $perl .= "'$quoted'"; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 5 | $perl .= $self->footer; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | # Loop over all of the remaining <* ... *> tag types, performing the | ||||||||||||||||||||||||||||||||||||||||||
| 46 | # prescribed replacements... run in reverse to process latest / deepest | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # subclass tags first | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # $self->debug && print Data::Dumper->Dump([[$templ->tags]],['tags']); | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # $self->debug && print Data::Dumper->Dump([$templ],['templ']); | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | foreach my $tag ( $templ->tags ) { | |||||||||||||||||||||||||||||||||||||||||
| 52 | 28 | $perl = $tag->process( $perl, $self ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 5 | ▶ | if ( $self->prettify ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | # Change any standalone single-quote print statements with | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # literal newlines in them to a series of individual print | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # or say statements for readability | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $perl =~ s{ | |||||||||||||||||||||||||||||||||||||||||
| 60 | (?: | ||||||||||||||||||||||||||||||||||||||||||
| 61 | # $1 = Previous statement separator | ||||||||||||||||||||||||||||||||||||||||||
| 62 | ( (?: ^ | \; | \{ | \} ) [ \t]*? (?:\r?\n)? ) | ||||||||||||||||||||||||||||||||||||||||||
| 63 | # $2 = Print statement indentation | ||||||||||||||||||||||||||||||||||||||||||
| 64 | ( \s*? ) | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # $3 = Double quote contents | ||||||||||||||||||||||||||||||||||||||||||
| 66 | print \s* '(.*?)(?<!\\)' | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # $4 = Closing brace or semicolon | ||||||||||||||||||||||||||||||||||||||||||
| 68 | ( \s* (?: (?:\;|\}) (?:\r?\n)? | $ ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 69 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | { $self->prettify_lines($1, $2, $3, $4) }egsx; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 5 | ▶ | if ( $self->tidy ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ($can_tidy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | require File::Temp; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | require Perl::Tidy; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # Using a temp file because the output is weird when we don't | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ( undef, my $tmp ) = File::Temp::tempfile(); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | Perl::Tidy::perltidy( | |||||||||||||||||||||||||||||||||||||||||
| 82 | 'source' => \$perl, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 'destination' => $tmp, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 'argv' => [ split /\s+/, $self->tidy_options ], | ||||||||||||||||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | open my $FH, '<', $tmp | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tmp || die("Unable to open file for reading ${tmp}: $!")
MC/DC0%0/1
$tmp || die("Unable to open file for reading ${tmp}: $!")
$tmp
Truth table0%0/2
A
A= $tmp
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | || die "Unable to open file for reading $tmp: $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | local $/ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $perl = <$FH>; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | close $FH; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | warn "Unable to load Perl::Tidy and/or File::Temp\n"; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 5 | ▶ | if ( $self->tidy || $self->prettify ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->tidy or $self->prettify
MC/DC0%0/2
$self->tidy or $self->prettify
$self->tidy
$self->prettify
Truth table33%1/3
A or B
A= $self->tidyB= $self->prettify
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | # Remove blank append statements | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $append = $self->append; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $perl =~ s/(?:^|(?<=\n)[ \t]*)\Q$append\E'';[ \t]*(?:\r?\n|$)//; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 5 | ▶ | if ( $self->debug ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my @lines = split /\n/, $perl; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $format = '%' . length( scalar(@lines) . '' ) . "s: %s\n"; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | print STDERR sprintf( $format, ( $_ + 1 ), $lines[$_] ) foreach (0 .. $#lines); | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 5 | return $perl; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | # Breaks a print statement with newlines in it into multiple statements | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # Helps with formatting code to preserve indentation (used when prettify is | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # enabled) | ||||||||||||||||||||||||||||||||||||||||||
| 116 | sub prettify_lines { | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prettify_lines: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $pre = shift; # Previous opening brace or semicolon | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $indent = shift; # Indentation spacing of the print statement | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $contents = shift; # Contents of the single quotes of the print | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $post = shift; # Closing brace or semicolon | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $out = $pre; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # Create a list of lines (and the ending partial line) in the print | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my @chunks = split /(.*?\n)/, $contents; | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | # print "CHUNK <<$_>>\n" foreach @chunks; | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | foreach ( 0 .. $#chunks ) { | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $is_last_chunk = ( $_ == $#chunks ); | |||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $chunk = $chunks[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | next if ( ( $chunk eq '' ) && ( not $is_last_chunk ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$chunk eq "" and not $is_last_chunk
MC/DC0%0/2
$chunk eq "" and not $is_last_chunk
$chunk eq ""
not $is_last_chunk
Truth table0%0/3
A and not(B)
A= $chunk eq ""B= not $is_last_chunk
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $nl = ''; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ( $chunk =~ s/\r\n$// ) { $nl = '\r\n'; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | elsif ( $chunk =~ s/\n$// ) { $nl = '\n'; } | |||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $statement; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if ($nl) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if ($self->append_pretty) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $statement = $self->append_pretty . "'$chunk'"; | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $statement = $self->append . "'$chunk'" . '."$nl"'; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $statement = $self->append . "'$chunk'"; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | $statement .= $is_last_chunk ? $post : ";\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $out .= $statement; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # Some override-able functions for subclasses | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub pretty_header { return ''; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pretty_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub header { die "Subclass must override Templ::Parser->header"; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub append { die "Subclass must override Templ::Parser->append"; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub append_pretty { return ''; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append_pretty: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub footer { die "Subclass must override Templ::Parser->footer"; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
footer: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # Utility Functions | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | # Returns the first defined value in a list, or a blank string if there are | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # # no defined values | ||||||||||||||||||||||||||||||||||||||||||
| 172 | sub _default (@) { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 45 | ▶ | foreach (@_) { defined($_) && return $_; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default: called CC=3 SCAR=11.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 178 | # Accessors... | ||||||||||||||||||||||||||||||||||||||||||
| 179 | sub debug { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 5 | ▶ | if ( defined $_[0] ) { $self->{'debug'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 5 | return _default $self->{'debug'}, $Templ::Parser::debug, 0; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | sub tidy { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 25 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tidy: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 25 | ▶ | if ( defined $_[0] ) { $self->{'tidy'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 25 | return _default $self->{'tidy'}, $Templ::Parser::tidy, 0; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | sub tidy_options { | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tidy_options: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ( defined $_[0] ) { $self->{'tidy_options'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return _default $self->{'tidy_options'}, $Templ::Parser::tidy_options, | |||||||||||||||||||||||||||||||||||||||||
| 195 | '-pbp -nst -b -aws -dws -dsm -nbbc -kbl=0 -asc -npro -sbl'; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | sub prettify { | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 15 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prettify: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 15 | ▶ | if ( defined $_[0] ) { $self->{'prettify'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 15 | ▶ | return _default $self->{'prettify'}, $Templ::Parser::prettify, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | ( $self->tidy ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||