App-Brl2Brl
view release on metacpan or search on metacpan
script/brl2brl view on Meta::CPAN
print "-r | --raw - Accepts indata other than utf8, e.g. CP1252.\n";
print "-l | --list - Lists available display tables in Liblouis path.\n";
print "-h | --help - This help screen.\n";
print "\n";
print "Use `perldoc brl2brl for additional documentation.\n";
} # usage
sub ver {
my $V = App::Brl2Brl->VERSION;
print "$0 version $V. The script belongs to the package App::Brl2Brl.\n";
} # ver
sub list_files {
opendir LLPATH, $table_path || die "Cannot open directory.\n";
my @files = sort readdir( LLPATH );
closedir( LLPATH );
my $found_dis = 0;
for my $fname (@files){
if( $fname =~ /\.dis$/ ){
print "$fname\n";
$found_dis++;
} # if
} # for
print "No Liblouis display tables found.\n" unless $found_dis >= 1;
} # list_files
Main:
unless( get_params() == 0){
die "Error! Run $0 --help for usage information\n";
exit 1;
}
if( $helpme ){
usage();
exit 0;
} # if
if( $print_version ){
ver();
exit 0;
} # if
if( $list_files ){
list_files();
exit 0;
} # if
my $brl_obj = App::Brl2Brl->new( {
path => $table_path,
from_table_file => $from_table_file,
to_table_file => $to_table_file,
} ); # new
if( $warn ){
$brl_obj->{warn} = 1;
} # if
my $content;
# If raw text, e.g. windows-1252.
if( $raw_data ){
use open IO => ":raw";
binmode(STDIN);
$content = <>;
} else {
local $/;
$content = <>;
} # if
my $s = $brl_obj->switch_brl_char_map( $content );
print "$s";
__DATA__
=encoding utf8
=head1 NAME
brl2brl - Converts between braille character sets found in liblouis.
=head1 VERSION
Version 0.05
=head1 DESCRIPTION
A script to convert between braille character sets. If you for instance have multiple braille printers with different characet set, you can use this script to convert the data you want to print accordingly. The respective display tables have to be pr...
=head1 SYNOPSIS
$ brl2brl --from | -f <from_table_file> --to | -t <to_table_file> [--path | -p <path-to-liblouis-tables>] <file-to-convert>
$ brl2brl -h | --help
$ brl2brl -l
=head1 AUTHOR
Lars Bjørndal
=head1 LICENSE AND COPYRIGHT
This software is Copyright (c) 2023 by Lars Bjørndal.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=head1 INSTALLATION
Using C<cpan>:
$ cpan App::Brl2Brl
Manual install:
$ perl Makefile.pl
$ make
$ make install
=cut
( run in 0.864 second using v1.01-cache-2.11-cpan-524268b4103 )