| 1 | package Text::FIGlet::Font; | ||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use vars qw($REwhite $VERSION); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use Carp qw(cluck confess); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use Symbol; #5.005 support | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Text::Wrap; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 7 | 4 | $VERSION = '2.19.3'; | |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||
| 9 | #'import' core support functions from parent with circular dependency | ||||||||||||||||||||||||||||||||||||
| 10 | 4 | foreach( qw/UTF8len UTF8ord _canonical _no _utf8_on/){ | |||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 12 | 20 | *$_ = *{'Text::FIGlet::'.$_}; | |||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | 17 | ▶ | sub new{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 17 | 17 | shift(); | |||||||||||||||||||||||||||||||||||
| 18 | 17 | my $self = {_maxLen=>0, -U=>-1, -m=>-2, @_}; | |||||||||||||||||||||||||||||||||||
| 19 | 17 | ▶ | $self->{-m} = -3 if defined($self->{-m}) && $self->{-m} eq '-0'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{"-m"} and $self->{"-m"} eq "-0"
MC/DC100%2/2
defined $self->{"-m"} and $self->{"-m"} eq "-0"
defined $self->{"-m"}
$self->{"-m"} eq "-0"
Truth table100%3/3
A and B
A= defined $self->{"-m"}B= $self->{"-m"} eq "-0"
| |||||||||||||||||||||||||||||||||||||
| 20 | 17 | ▶ | $self->{-f} ||= $ENV{FIGFONT} || 'standard'; | ||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$self->{"-f"} ||= $ENV{"FIGFONT"} || "standard"
$ENV{'FIGFONT'} || 'standard'
MC/DC0%0/2
$self->{"-f"} ||= $ENV{"FIGFONT"} || "standard"
$self->{"-f"}
$ENV{'FIGFONT'}
Truth table33%1/3
A ||= B
A= $self->{"-f"}B= $ENV{'FIGFONT'}
| |||||||||||||||||||||||||||||||||||||
| 21 | 17 | ▶ | $self->{-d} ||= $ENV{FIGLIB} || '/usr/games/lib/figlet/'; | ||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$self->{"-d"} ||= $ENV{"FIGLIB"} || "/usr/games/lib/figlet/"
$ENV{'FIGLIB'} || '/usr/games/lib/figlet/'
MC/DC0%0/2
$self->{"-d"} ||= $ENV{"FIGLIB"} || "/usr/games/lib/figlet/"
$self->{"-d"}
$ENV{'FIGLIB'}
Truth table66%2/3
A ||= B
A= $self->{"-d"}B= $ENV{'FIGLIB'}
| |||||||||||||||||||||||||||||||||||||
| 22 | 17 | _load_font($self); | |||||||||||||||||||||||||||||||||||
| 23 | 17 | bless($self); | |||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||
| 26 | 17 | ▶ | sub _load_font{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
_load_font: called CC=49 SCAR=42.0
| |||||||||||||||||||||||||||||||||||||
| 27 | 17 | my $self = shift(); | |||||||||||||||||||||||||||||||||||
| 28 | 17 | my $font = $self->{_font} = []; | |||||||||||||||||||||||||||||||||||
| 29 | 17 | my(@header, $header, $path, $ext); | |||||||||||||||||||||||||||||||||||
| 30 | 17 | local($_); | |||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||
| 32 | #MAGIC minifig0 | ||||||||||||||||||||||||||||||||||||
| 33 | 17 | $self->{_file} = _canonical($self->{-d}, $self->{-f}, qr/\.[ft]lf/, | |||||||||||||||||||||||||||||||||||
| 34 | $^O =~ /MSWin32|DOS/i); | ||||||||||||||||||||||||||||||||||||
| 35 | #XXX bsd_glob .[ft]lf | ||||||||||||||||||||||||||||||||||||
| 36 | 4 | ▶ | $self->{_file} = (glob($self->{_file}.'.?lf'))[0] unless -e $self->{_file}; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||
| 38 | #open(FLF, $self->{_file}) || confess("$!: $self->{_file}"); | ||||||||||||||||||||||||||||||||||||
| 39 | 17 | $self->{_fh} = gensym; #5.005 support | |||||||||||||||||||||||||||||||||||
| 40 | 4 | ▶ | eval "use IO::Uncompress::Unzip"; #XXX sniff for 'PK\003\004'instead? | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 41 | 17 | ▶ | unless( $@ ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 42 | 17 | ▶ | $self->{_fh} = eval{ IO::Uncompress::Unzip->new($self->{_file}) } || | ||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
'IO::Uncompress::Unzip'->new($self->{'_file'})
}
} || confess("No such file or directory: $self->{'_file'}")
MC/DC0%0/1
eval {
do {
'IO::Uncompress::Unzip'->new($self->{'_file'})
}
} || confess("No such file or directory: $self->{'_file'}")
eval {
do {
'IO::Uncompress::Unzip'->new($self->{'_file'})
}
}
Truth table50%1/2
A
A= eval {
do {
'IO::Uncompress::Unzip'->new($self->{'_file'})
}
}
| |||||||||||||||||||||||||||||||||||||
| 43 | confess("No such file or directory: $self->{_file}"); | ||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||
| 45 | else{ | ||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | open($self->{_fh}, '<'.$self->{_file}) || confess("$!: $self->{_file}"); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 47 | #$^W isn't mutable at runtime in 5.005, so we have to conditional eval | ||||||||||||||||||||||||||||||||||||
| 48 | #to avoid "Useless use of constant in void context" | ||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | eval "binmode(\$fh, ':encoding(utf8)')" unless $] < 5.006; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||
| 51 | #MAGIC minifig1 | ||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | 17 | my $fh = $self->{_fh}; #5.005 support | |||||||||||||||||||||||||||||||||||
| 54 | 17 | chomp($header = <$fh>); #5.005 hates readline & $self->{_fh} :-/ | |||||||||||||||||||||||||||||||||||
| 55 | 17 | ▶ | confess("Invalid FIGlet 2/TOIlet font") unless $header =~ /^[ft]lf2/; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||
| 57 | #flf2ahardblank height up_ht maxlen smushmode cmt_count rtol | ||||||||||||||||||||||||||||||||||||
| 58 | 17 | @header = split(/\s+/, $header); | |||||||||||||||||||||||||||||||||||
| 59 | 17 | $header[0] =~ s/^[ft]lf2.//; | |||||||||||||||||||||||||||||||||||
| 60 | #$header[0] = qr/@{[sprintf "\\%o", ord($header[0])]}/; | ||||||||||||||||||||||||||||||||||||
| 61 | 17 | $header[0] = quotemeta($header[0]); | |||||||||||||||||||||||||||||||||||
| 62 | 17 | $self->{_header} = \@header; | |||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||
| 64 | 17 | ▶ | if( defined($self->{-m}) && $self->{-m} eq '-2' ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{"-m"} and $self->{"-m"} eq -2
MC/DC100%2/2
defined $self->{"-m"} and $self->{"-m"} eq -2
defined $self->{"-m"}
$self->{"-m"} eq -2
Truth table100%3/3
A and B
A= defined $self->{"-m"}B= $self->{"-m"} eq -2
| |||||||||||||||||||||||||||||||||||||
| 65 | 3 | $self->{-m} = $header[4]; | |||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||
| 68 | #Discard comments | ||||||||||||||||||||||||||||||||||||
| 69 | 17 | ▶ | <$fh> for 1 .. $header[5] || cluck("Unexpected end of font file") && last; | ||||||||||||||||||||||||||||||||||
|
Condition20%1/5
$header[5] || cluck('Unexpected end of font file') && (last)
cluck("Unexpected end of font file") and last
MC/DC0%0/2
$header[5] || cluck('Unexpected end of font file') && (last)
$header[5]
cluck("Unexpected end of font file")
Truth table33%1/3
A || B
A= $header[5]B= cluck("Unexpected end of font file")
| |||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||
| 71 | #Get ASCII characters | ||||||||||||||||||||||||||||||||||||
| 72 | 17 | foreach my $i(32..126){ | |||||||||||||||||||||||||||||||||||
| 73 | 1615 | ▶ | &_load_char($self, $i) || last; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||
| 76 | #German characters? | ||||||||||||||||||||||||||||||||||||
| 77 | 17 | ▶ | unless( eof($fh) ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 78 | 17 | my %D =(91=>196, 92=>214, 93=>220, 123=>228, 124=>246, 125=>252, 126=>223); | |||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||
| 80 | 17 | foreach my $k ( sort {$a <=> $b} keys %D ){ | |||||||||||||||||||||||||||||||||||
| 81 | 119 | ▶ | &_load_char($self, $D{$k}) || last; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||
| 83 | 17 | ▶ | if( $self->{-D} ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 84 | 1 | $font->[$_] = $font->[$D{$_}] for keys %D; | |||||||||||||||||||||||||||||||||||
| 85 | #removal is necessary to prevent 2nd reference to same figchar, | ||||||||||||||||||||||||||||||||||||
| 86 | #which would then become over-smushed; alas 5.005 can't delete arrays | ||||||||||||||||||||||||||||||||||||
| 87 | 1 | $#{$font} = 126; #undef($font->[$_]) for values %D; | |||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||
| 91 | #ASCII bypass | ||||||||||||||||||||||||||||||||||||
| 92 | 17 | ▶ | close($fh) unless $self->{-U}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||
| 94 | #Extended characters, with extra readline to get code | ||||||||||||||||||||||||||||||||||||
| 95 | 17 | ▶ | until( eof($fh) ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 96 | 1636 | ▶ | $_ = <$fh> || cluck("Unexpected end of font file") && last; | ||||||||||||||||||||||||||||||||||
|
Condition20%1/5
readline $fh || cluck('Unexpected end of font file') && (last)
cluck("Unexpected end of font file") and last
MC/DC0%0/2
readline $fh || cluck('Unexpected end of font file') && (last)
readline $fh
cluck("Unexpected end of font file")
Truth table33%1/3
A || B
A= readline $fhB= cluck("Unexpected end of font file")
| |||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||
| 98 | 1636 | /^\s*$Text::FIGlet::RE{no}/; | |||||||||||||||||||||||||||||||||||
| 99 | 1636 | ▶ | last unless $2; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 100 | 1636 | my $val = _no($1, $2, $3, 1); | |||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||
| 102 | #Bypass negative chars? | ||||||||||||||||||||||||||||||||||||
| 103 | 1636 | ▶ | if( $val > Text::FIGlet->PRIVb && $self->{-U} == -1 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$val > "Text::FIGlet"->PRIVb and $self->{"-U"} == -1
MC/DC0%0/2
$val > "Text::FIGlet"->PRIVb and $self->{"-U"} == -1
$val > "Text::FIGlet"->PRIVb
$self->{"-U"} == -1
Truth table66%2/3
A and B
A= $val > "Text::FIGlet"->PRIVbB= $self->{"-U"} == -1
| |||||||||||||||||||||||||||||||||||||
| 104 | 0 | readline($fh) for 0..$self->{_header}->[1]-1; | |||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||
| 106 | else{ | ||||||||||||||||||||||||||||||||||||
| 107 | #Clobber German chars | ||||||||||||||||||||||||||||||||||||
| 108 | 1636 | $font->[$val] = ''; | |||||||||||||||||||||||||||||||||||
| 109 | 1636 | ▶ | &_load_char($self, $val) || last; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||
| 112 | 17 | close($fh); | |||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||
| 115 | #Fixed width | ||||||||||||||||||||||||||||||||||||
| 116 | 17 | ▶ | if( defined($self->{-m}) && $self->{-m} == -3 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
defined $self->{"-m"} and $self->{"-m"} == -3
MC/DC100%2/2
defined $self->{"-m"} and $self->{"-m"} == -3
defined $self->{"-m"}
$self->{"-m"} == -3
Truth table100%3/3
A and B
A= defined $self->{"-m"}B= $self->{"-m"} == -3
| |||||||||||||||||||||||||||||||||||||
| 117 | 1 | my $pad; | |||||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | for(my $ord=0; $ord < scalar @{$font}; $ord++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 119 | 734 | ▶ | next unless defined $font->[$ord]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 120 | 324 | foreach my $i (-$header[1]..-1){ | |||||||||||||||||||||||||||||||||||
| 121 | #next unless exists($font->[$ord]->[2]); #55compat | ||||||||||||||||||||||||||||||||||||
| 122 | 1944 | ▶ | next unless defined($font->[$ord]->[2]); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||
| 124 | # The if protects from a a 5.6(.0)? bug | ||||||||||||||||||||||||||||||||||||
| 125 | 1944 | ▶ | $font->[$ord]->[$i] =~ s/^\s{1,$font->[$ord]->[1]}// | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 126 | if $font->[$ord]->[1]; | ||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||
| 128 | 1944 | $pad = $self->{_maxLen} - UTF8len($font->[$ord]->[$i]); | |||||||||||||||||||||||||||||||||||
| 129 | # print STDERR "$pad = $self->{_maxLen} - UTF8len($font->[$ord]->[$i]);\n"; | ||||||||||||||||||||||||||||||||||||
| 130 | 1944 | $font->[$ord]->[$i] = " " x int($pad/2) . | |||||||||||||||||||||||||||||||||||
| 131 | $font->[$ord]->[$i] . " " x ($pad-int($pad/2)); | ||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||
| 135 | #Full width | ||||||||||||||||||||||||||||||||||||
| 136 | ▶ | elsif( defined($self->{-m}) && $self->{-m} == -1 ){ | |||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $self->{"-m"} and $self->{"-m"} == -1
MC/DC100%2/2
defined $self->{"-m"} and $self->{"-m"} == -1
defined $self->{"-m"}
$self->{"-m"} == -1
Truth table100%3/3
A and B
A= defined $self->{"-m"}B= $self->{"-m"} == -1
| |||||||||||||||||||||||||||||||||||||
| 137 | 11 | ▶ | for(my $ord=32; $ord < scalar @{$font}; $ord++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 138 | 23988 | ▶ | next unless defined $font->[$ord]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 139 | 1376 | foreach my $i (-$header[1]..-1){ | |||||||||||||||||||||||||||||||||||
| 140 | 6528 | ▶ | next unless $font->[$ord]->[$i]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 141 | # The if protects from a a 5.6(.0)? bug | ||||||||||||||||||||||||||||||||||||
| 142 | 6528 | ▶ | $font->[$ord]->[$i] =~ s/^\s{1,$font->[$ord]->[1]}// | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 143 | if $font->[$ord]->[1]; | ||||||||||||||||||||||||||||||||||||
| 144 | 6528 | substr($font->[$ord]->[$i], 0, 0, ' 'x$font->[$ord]->[1]); | |||||||||||||||||||||||||||||||||||
| 145 | 6528 | $font->[$ord]->[$i] .= ' 'x$font->[$ord]->[2]; | |||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||
| 149 | #Kern glyph boxes | ||||||||||||||||||||||||||||||||||||
| 150 | ▶ | elsif( !defined($self->{-m}) || $self->{-m} > -1 ){ | |||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not defined $self->{"-m"} or $self->{"-m"} > -1
MC/DC0%0/2
not defined $self->{"-m"} or $self->{"-m"} > -1
not defined $self->{"-m"}
$self->{"-m"} > -1
Truth table66%2/3
not(A) or B
A= not defined $self->{"-m"}B= $self->{"-m"} > -1
| |||||||||||||||||||||||||||||||||||||
| 151 | 5 | ▶ | for(my $ord=32; $ord < scalar @{$font}; $ord++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 152 | 1047305 | ▶ | next unless defined $font->[$ord]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 153 | 1621 | foreach my $i (-$header[1]..-1){ | |||||||||||||||||||||||||||||||||||
| 154 | 9726 | ▶ | next unless $font->[$ord]->[$i]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 155 | # The if protects from a a 5.6(.0)? bug | ||||||||||||||||||||||||||||||||||||
| 156 | 9726 | ▶ | $font->[$ord]->[$i] =~ s/^\s{1,$font->[$ord]->[1]}// | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 157 | if $font->[$ord]->[1]; | ||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||
| 164 | 3370 | ▶ | sub _load_char{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
_load_char: called CC=15 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||
| 165 | 3370 | my($self, $i) = @_; | |||||||||||||||||||||||||||||||||||
| 166 | 3370 | my $font = $self->{_font}; | |||||||||||||||||||||||||||||||||||
| 167 | 3370 | my($length, $wLead, $wTrail, $end, $line, $l) = 0; | |||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||
| 169 | 3370 | $wLead = $wTrail = $self->{_header}->[3]; | |||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||
| 171 | 3370 | my $fh = $self->{_fh}; #5.005 support | |||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||
| 173 | 3370 | my $REtrail; | |||||||||||||||||||||||||||||||||||
| 174 | 3370 | foreach my $j (0..$self->{_header}->[1]-1){ | |||||||||||||||||||||||||||||||||||
| 175 | 18492 | ▶ | $line = $_ = <$fh> || | ||||||||||||||||||||||||||||||||||
|
Condition20%1/5
readline $fh || cluck('Unexpected end of font file') && (return 0)
cluck("Unexpected end of font file") and return 0
MC/DC0%0/2
readline $fh || cluck('Unexpected end of font file') && (return 0)
readline $fh
cluck("Unexpected end of font file")
Truth table33%1/3
A || B
A= readline $fhB= cluck("Unexpected end of font file")
| |||||||||||||||||||||||||||||||||||||
| 176 | cluck("Unexpected end of font file") && return 0; | ||||||||||||||||||||||||||||||||||||
| 177 | #This is the end.... this is the end my friend | ||||||||||||||||||||||||||||||||||||
| 178 | 18492 | ▶ | unless( $REtrail ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 179 | 3370 | /(.)\s*$/; | |||||||||||||||||||||||||||||||||||
| 180 | 3370 | $end = $1; | |||||||||||||||||||||||||||||||||||
| 181 | #The negative leading anchor is for term.flf 0x40 | ||||||||||||||||||||||||||||||||||||
| 182 | 3370 | $REtrail = qr/(?<!^)([ $self->{_header}->[0]]+)\Q$end{1,2}\E?\s*$/; | |||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||
| 184 | 18492 | ▶ | if( $wLead && s/^(\s+)// ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$wLead and s/^(\s+)//
MC/DC100%2/2
$wLead and s/^(\s+)//
$wLead
s/^(\s+)//
Truth table100%3/3
A and B
A= $wLeadB= s/^(\s+)//
| |||||||||||||||||||||||||||||||||||||
| 185 | 17359 | ▶ | $wLead = $l if ($l = length($1)) < $wLead; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||
| 187 | else{ | ||||||||||||||||||||||||||||||||||||
| 188 | 1133 | $wLead = 0; | |||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||
| 190 | 18492 | ▶ | if( $wTrail && /$REtrail/ ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$wTrail and /$REtrail/
MC/DC0%0/2
$wTrail and /$REtrail/
$wTrail
/$REtrail/
Truth table66%2/3
A and B
A= $wTrailB= /$REtrail/
| |||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $wTrail = $l if ($l = length($1)) < $wTrail; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||
| 193 | else{ | ||||||||||||||||||||||||||||||||||||
| 194 | 18492 | $wTrail = 0; | |||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||
| 196 | 18492 | ▶ | $length = $l if ($l = UTF8len($_) | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
s/(\Q$end\E+)$/$end/ && UTF8len($1)
MC/DC100%2/2
s/(\Q$end\E+)$/$end/ && UTF8len($1)
s/(\Q$end\E+)$/$end/
UTF8len($1)
Truth table100%3/3
A && B
A= s/(\Q$end\E+)$/$end/B= UTF8len($1)
| |||||||||||||||||||||||||||||||||||||
| 197 | -(s/(\Q$end\E+)$/$end/&&UTF8len($1)) ) > $length; | ||||||||||||||||||||||||||||||||||||
| 198 | 18492 | $font->[$i] .= $line; | |||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||
| 200 | #XXX :-/ stop trying at 125 in case of charmap in ~ or extended.... | ||||||||||||||||||||||||||||||||||||
| 201 | 3370 | ▶ | $self->{_maxLen} = $length if $i < 126 && $self->{_maxLen} < $length; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i < 126 and $self->{"_maxLen"} < $length
MC/DC100%2/2
$i < 126 and $self->{"_maxLen"} < $length
$i < 126
$self->{"_maxLen"} < $length
Truth table100%3/3
A and B
A= $i < 126B= $self->{"_maxLen"} < $length
| |||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||
| 203 | #Ideally this would be /o but then all figchar's must have same EOL | ||||||||||||||||||||||||||||||||||||
| 204 | 3370 | $font->[$i] =~ s/\015|\Q$end\E{1,2}\s*\r?$//mg; | |||||||||||||||||||||||||||||||||||
| 205 | 3370 | $font->[$i] = [$length,#maxLen | |||||||||||||||||||||||||||||||||||
| 206 | $wLead, #wLead | ||||||||||||||||||||||||||||||||||||
| 207 | $wTrail,#wTrail | ||||||||||||||||||||||||||||||||||||
| 208 | split(/\r|\r?\n/, $font->[$i])]; | ||||||||||||||||||||||||||||||||||||
| 209 | 3370 | return 1; | |||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||
| 213 | 21 | ▶ | sub figify{ | ||||||||||||||||||||||||||||||||||
|
Subroutine
figify: called CC=43 SCAR=38.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 214 | 21 | my $self = shift(); | |||||||||||||||||||||||||||||||||||
| 215 | 21 | my $font = $self->{_font}; | |||||||||||||||||||||||||||||||||||
| 216 | 21 | my %opts = (-A=>'', -X=>'', -x=>'', -w=>'', -U=>0, @_); | |||||||||||||||||||||||||||||||||||
| 217 | 21 | my @buffer; | |||||||||||||||||||||||||||||||||||
| 218 | 21 | local $_; | |||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||
| 220 | 21 | ▶ | $opts{-w} ||= 80; | ||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts{"-w"} ||= 80
MC/DC100%1/1
$opts{"-w"} ||= 80
$opts{"-w"}
Truth table100%2/2
A
A= $opts{"-w"}
| |||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||
| 222 | #Prepare the input | ||||||||||||||||||||||||||||||||||||
| 223 | 21 | ▶ | $opts{-X} ||= $self->{_header}->[6] ? 'R' : 'L'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opts{"-X"} ||= $self->{"_header"}[6] ? "R" : "L"
MC/DC0%0/2
$opts{"-X"} ||= $self->{"_header"}[6] ? "R" : "L"
$opts{"-X"}
$self->{"_header"}[6] ? "R" : "L"
Truth table66%2/3
A ||= B
A= $opts{"-X"}B= $self->{"_header"}[6] ? "R" : "L"
| |||||||||||||||||||||||||||||||||||||
| 224 | 21 | ▶ | if( $opts{-X} eq 'R' ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 225 | 1 | $opts{-A} = join('', reverse(split('', $opts{-A}))); | |||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||
| 228 | 21 | $opts{-A} =~ y/\t/ /; | |||||||||||||||||||||||||||||||||||
| 229 | 21 | ▶ | $opts{-A} =~ s%$/%\n% unless $/ eq "\n"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 230 | 21 | ▶ | if( defined($self->{-m}) && $self->{-m} == -3 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
defined $self->{"-m"} and $self->{"-m"} == -3
MC/DC100%2/2
defined $self->{"-m"} and $self->{"-m"} == -3
defined $self->{"-m"}
$self->{"-m"} == -3
Truth table100%3/3
A and B
A= defined $self->{"-m"}B= $self->{"-m"} == -3
| |||||||||||||||||||||||||||||||||||||
| 231 | 1 | $Text::Wrap::columns = int($opts{-w} / $self->{_maxLen})+1; | |||||||||||||||||||||||||||||||||||
| 232 | 1 | ▶ | $Text::Wrap::columns =2 if $Text::Wrap::columns < 2; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 233 | 1 | $opts{-A} = Text::Wrap::wrap('', '', $opts{-A}); | |||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | &Encode::_utf8_off($opts{-A}) if $] >= 5.008; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||
| 236 | elsif( $opts{-w} > 0 ){ | ||||||||||||||||||||||||||||||||||||
| 237 | 20 | ▶ | &Encode::_utf8_off($opts{-A}) if $] >= 5.008; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 238 | 20 | $Text::Wrap::columns = $opts{-w}+1; | |||||||||||||||||||||||||||||||||||
| 239 | 20 | ▶ | unless( $opts{-w} == 1 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 240 | 20 | ($_, $opts{-A}) = ($opts{-A}, ''); | |||||||||||||||||||||||||||||||||||
| 241 | # $opts{-A} .= "\0"x(($font->[ ord($1) ]->[0]||1)-1) . $1 while /(.)/g; | ||||||||||||||||||||||||||||||||||||
| 242 | 20 | ▶ | while( $opts{-U} ? | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 243 | /$Text::FIGlet::RE{UTFchar}/g : | ||||||||||||||||||||||||||||||||||||
| 244 | /$Text::FIGlet::RE{bytechar}/g ){ | ||||||||||||||||||||||||||||||||||||
| 245 | $opts{-A} .= "\0"x(($font->[ | ||||||||||||||||||||||||||||||||||||
| 246 | 102 | ▶ | $opts{-U} ? UTF8ord($1) : ord($1) | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$$font[$opts{'-U'} ? UTF8ord($1) : ord $1][0] || 1
MC/DC100%1/1
$$font[$opts{'-U'} ? UTF8ord($1) : ord $1][0] || 1
$$font[$opts{'-U'} ? UTF8ord($1) : ord $1][0]
Truth table100%2/2
A
A= $$font[$opts{'-U'} ? UTF8ord($1) : ord $1][0]
| |||||||||||||||||||||||||||||||||||||
| 247 | ]->[0]||1)-1) . $1; | ||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||
| 250 | #XXX pre 5.8 Text::Wrap is not Unicode happy? | ||||||||||||||||||||||||||||||||||||
| 251 | 20 | $opts{-A} = Text::Wrap::wrap('', '', $opts{-A}); | |||||||||||||||||||||||||||||||||||
| 252 | 20 | $opts{-A} =~ tr/\0//d; | |||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||
| 255 | #Assemble glyphs | ||||||||||||||||||||||||||||||||||||
| 256 | 21 | ▶ | my $X = defined($self->{-m}) && $self->{-m} < 0 ? '' : "\000"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{"-m"} and $self->{"-m"} < 0
MC/DC100%2/2
defined $self->{"-m"} and $self->{"-m"} < 0
defined $self->{"-m"}
$self->{"-m"} < 0
Truth table100%3/3
A and B
A= defined $self->{"-m"}B= $self->{"-m"} < 0
| |||||||||||||||||||||||||||||||||||||
| 257 | 21 | foreach( split("\n", $opts{-A}) ){ | |||||||||||||||||||||||||||||||||||
| 258 | 23 | my(@lchars, @lines); | |||||||||||||||||||||||||||||||||||
| 259 | 23 | s/^\s*//o; #XXX | |||||||||||||||||||||||||||||||||||
| 260 | # push(@lchars, ord $1) while /(.)/g; | ||||||||||||||||||||||||||||||||||||
| 261 | 23 | ▶ | while( $opts{-U} ? | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 262 | /$Text::FIGlet::RE{UTFchar}/g : | ||||||||||||||||||||||||||||||||||||
| 263 | /$Text::FIGlet::RE{bytechar}/g ){ | ||||||||||||||||||||||||||||||||||||
| 264 | 111 | ▶ | push @lchars, ($opts{-U} ? UTF8ord($1) : ord($1)); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||
| 267 | 23 | foreach my $i (-$self->{_header}->[1]..-1){ | |||||||||||||||||||||||||||||||||||
| 268 | 129 | my $line=''; | |||||||||||||||||||||||||||||||||||
| 269 | 129 | foreach my $lchar (@lchars){ | |||||||||||||||||||||||||||||||||||
| 270 | 585 | ▶ | if( $font->[$lchar] ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 271 | 585 | ▶ | $line .= $font->[$lchar]->[$i] . $X if $font->[$lchar]->[$i]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||
| 273 | else{ | ||||||||||||||||||||||||||||||||||||
| 274 | 0 | $line .= $font->[32]->[$i] . $X; | |||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||
| 278 | 129 | $line =~ s/\000$//; | |||||||||||||||||||||||||||||||||||
| 279 | 129 | push @lines, $line; | |||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||
| 282 | #Kern glyphs? | ||||||||||||||||||||||||||||||||||||
| 283 | 23 | ▶ | if( !defined($self->{-m}) || $self->{-m} > -1 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $self->{"-m"} or $self->{"-m"} > -1
MC/DC100%2/2
not defined $self->{"-m"} or $self->{"-m"} > -1
not defined $self->{"-m"}
$self->{"-m"} > -1
Truth table100%3/3
not(A) or B
A= not defined $self->{"-m"}B= $self->{"-m"} > -1
| |||||||||||||||||||||||||||||||||||||
| 284 | 13 | ▶ | for(my $nulls = 0; $nulls < scalar @lchars ; $nulls++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 285 | 47 | my $matches = 0; | |||||||||||||||||||||||||||||||||||
| 286 | 47 | my @temp; | |||||||||||||||||||||||||||||||||||
| 287 | 47 | ▶ | for(my $i=0; $i<scalar @lines; $i++){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 288 | 300 | $matches += ($temp[$i] = $lines[$i]) =~ | |||||||||||||||||||||||||||||||||||
| 289 | s/^([^\000]*(?:\000[^\000]*){$nulls})(?: \000|\000(?: |\Z))/$1\000/; | ||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||
| 291 | #($_ = $temp[$i]) =~ s/(${stem}{$nulls})/$1@/; | ||||||||||||||||||||||||||||||||||||
| 292 | #print "$nulls, $i) $matches == @{[scalar @lines]} #$_\n"; | ||||||||||||||||||||||||||||||||||||
| 293 | 300 | ▶ | if( $i == scalar(@lines)-1 && $matches == scalar @lines ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i == scalar(@lines) - 1 and $matches == scalar @lines
MC/DC100%2/2
$i == scalar(@lines) - 1 and $matches == scalar @lines
$i == scalar(@lines) - 1
$matches == scalar @lines
Truth table100%3/3
A and B
A= $i == scalar(@lines) - 1B= $matches == scalar @lines
| |||||||||||||||||||||||||||||||||||||
| 294 | 3 | @lines = @temp; | |||||||||||||||||||||||||||||||||||
| 295 | 3 | $matches = 0; | |||||||||||||||||||||||||||||||||||
| 296 | 3 | $i = -1; | |||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||
| 302 | 23 | push @buffer, @lines; | |||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||
| 306 | #Layout | ||||||||||||||||||||||||||||||||||||
| 307 | 21 | ▶ | $opts{-x} ||= $opts{-X} eq 'R' ? 'r' : 'l'; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opts{"-x"} ||= $opts{"-X"} eq "R" ? "r" : "l"
MC/DC0%0/2
$opts{"-x"} ||= $opts{"-X"} eq "R" ? "r" : "l"
$opts{"-x"}
$opts{"-X"} eq "R" ? "r" : "l"
Truth table66%2/3
A ||= B
A= $opts{"-x"}B= $opts{"-X"} eq "R" ? "r" : "l"
| |||||||||||||||||||||||||||||||||||||
| 308 | 21 | foreach my $line (@buffer){ | |||||||||||||||||||||||||||||||||||
| 309 | #Smush | ||||||||||||||||||||||||||||||||||||
| 310 | 129 | ▶ | if( !defined($self->{-m}) || $self->{-m} > 0 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $self->{"-m"} or $self->{"-m"} > 0
MC/DC100%2/2
not defined $self->{"-m"} or $self->{"-m"} > 0
not defined $self->{"-m"}
$self->{"-m"} > 0
Truth table100%3/3
not(A) or B
A= not defined $self->{"-m"}B= $self->{"-m"} > 0
| |||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||
| 313 | #Universal smush/overlap | ||||||||||||||||||||||||||||||||||||
| 314 | 18 | $line =~ s/\000 //g; | |||||||||||||||||||||||||||||||||||
| 315 | 18 | $line =~ s/$Text::FIGlet::RE{UTFchar}\000//g; | |||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||
| 317 | else{ | ||||||||||||||||||||||||||||||||||||
| 318 | 111 | $line =~ y/\000//d; | |||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||
| 321 | #Alignment | ||||||||||||||||||||||||||||||||||||
| 322 | 129 | ▶ | if( $opts{-x} eq 'c' ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 323 | 6 | $line = " "x(($opts{-w}-UTF8len($line))/2) . $line; | |||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||
| 325 | elsif( $opts{-x} eq 'r' ){ | ||||||||||||||||||||||||||||||||||||
| 326 | 12 | $line = " "x($opts{-w}-UTF8len($line)) . $line; | |||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||
| 329 | #Replace hardblanks | ||||||||||||||||||||||||||||||||||||
| 330 | 129 | $line =~ s/$self->{_header}->[0]/ /g; | |||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||
| 334 | 21 | ▶ | if( $] < 5.006 ){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | return wantarray ? @buffer : join($/, @buffer).$/; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||
| 337 | else{ | ||||||||||||||||||||||||||||||||||||
| 338 | #Properly promote (back) to utf-8 | ||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | return wantarray ? map{_utf8_on($_)} @buffer : | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 340 | _utf8_on($_=join($/, @buffer).$/); | ||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||
| 345 | 4 | 1; | |||||||||||||||||||||||||||||||||||
| 346 | __END__ | ||||||||||||||||||||||||||||||||||||