blib/script/fribidi.pl untested

filter: Statementstmt 0.0% 0 / 51 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 9 Podpod n/a totaltotal 0.0% 0 / 84 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2  
3 # PODNAME: fribidi.pl
4 # ABSTRACT: Convert logical text to visual, via the unicode bidi algorithm
5  
6 use 5.10.0;
7 use warnings;
8 use integer;
9 use strict;
10  
11 use open ':encoding(utf8)';
12 use open ':std';
13  
14 use Text::Bidi 2.07 qw(log2vis get_bidi_type_name fribidi_version);
15 use Text::Bidi::Constants;
16 #use Carp::Always;
17  
18 use Getopt::Long qw(:config gnu_getopt auto_help auto_version);
19 our $VERSION = "2.07\nlibfribidi " . fribidi_version;
20 our $width = $ENV{'COLUMNS'} // 80;
21 our %Opts = ('width=i' => \$width);
22 GetOptions(\%Opts, qw(break:s rtl! ltr! levels! hex! dir! ltov! types! verbose! width=i));
23  
24 $Opts{'break'} = ' ' if defined($Opts{'break'}) and ($Opts{'break'} eq '');
25 if ($Opts{'verbose'}) {
26 $Opts{$_} = 1 foreach (qw(levels dir ltov types hex));
27 }
28  
29  
30 # read paragraphs (and make perlcritic happy with 'local')
31 local $/ = '';
32 my $flags;
33 $flags = { break => $Opts{'break'} } if defined $Opts{'break'};
34 my $dir = $Opts{'rtl'} ? $Text::Bidi::Par::RTL
35 : $Opts{'ltr'} ? $Text::Bidi::Par::LTR : undef;
36 while (<>) {
37 chomp;
38 s/ *\n */ /g;
39 my ($p, $visual) = log2vis($_, $width, $dir, $flags);
40 say $visual;
41 say '';
42 say STDERR "Base dir: " . get_bidi_type_name($p->dir) if $Opts{'dir'};
43 say STDERR "Hex: " . join(' ', map { sprintf("%x", ord($_)) } split '');
44 say STDERR "Types: " . join(' ', $p->type_names) if $Opts{'types'};
45 say STDERR "Levels: " . join(' ', @{$p->levels}) if $Opts{'levels'};
46 }
47  
48 # start of POD
49  
50 __END__