NAME
Unicode::Block::Ascii - Ascii output of unicode block.
SYNOPSIS
use Unicode::Block::Ascii;
my $obj = Unicode::Block::Ascii->new(%parameters);
my $output = $obj->get;
my $item = $obj->next;
METHODS
new
my $obj = Unicode::Block::Ascii->new(%parameters);
Constructor.
char_from
Character from.
Default value is '0000'.
char_to
Character to.
Default value is '007f'.
title
Title of block.
Default value is undef.
Returns instance of object.
get
my $output = $obj->get;
Get output.
Return string with ascii table of Unicode::Block object.
next
my $item = $obj->next;
Get next character.
Returns Unicode::Block::Item object for character, if character exists. Returns undef, if character doesn't exist.
ERRORS
new():
From Class::Utils::set_params_pub():
Unknown parameter '%s'.
get():
Long title.
EXAMPLE1
use strict;
use warnings;
use Encode qw(encode_utf8);
use Unicode::Block::Ascii;
use Unicode::Block::List;
# Arguments.
if (@ARGV < 1) {
print STDERR "Usage: $0 block_name\n";
exit 1;
}
my $block_name = $ARGV[0];
# List object.
my $obj = Unicode::Block::List->new;
# Get Unicode::Block for block name.
my $block = $obj->block($block_name);
# Get ASCII object.
my $block_ascii = Unicode::Block::Ascii->new(%{$block});
# Print to output.
print encode_utf8($block_ascii->get)."\n";
# Output:
# Usage: /tmp/o1NG0vm_Wf block_name
# Output with 'Block Elements' argument:
# ┌────────────────────────────────────────┐
# │ Block Elements │
# ├────────┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┤
# │ │0│1│2│3│4│5│6│7│8│9│A│B│C│D│E│F│
# ├────────┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
# │ U+258x │▀│▁│▂│▃│▄│▅│▆│▇│█│▉│▊│▋│▌│▍│▎│▏│
# ├────────┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
# │ U+259x │▐│░│▒│▓│▔│▕│▖│▗│▘│▙│▚│▛│▜│▝│▞│▟│
# └────────┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
EXAMPLE2
use strict;
use warnings;
use Curses::UI;
use Encode qw(encode_utf8);
use Unicode::Block::Ascii;
use Unicode::Block::List;
# Get unicode block list.
my $list = Unicode::Block::List->new;
my @unicode_block_list = $list->list;
# Window.
my $cui = Curses::UI->new;
my $win = $cui->add('window_id', 'Window');
$win->set_binding(\&exit, "\cQ", "\cC");
# Popup menu.
my $popupbox = $win->add(
'mypopupbox', 'Popupmenu',
'-labels' => {
map { $_, $_ } @unicode_block_list,
},
'-onchange' => sub {
my $self = shift;
$cui->leave_curses;
my $block = $list->block($self->get);
my $block_ascii = Unicode::Block::Ascii->new(%{$block});
print encode_utf8($block_ascii->get)."\n";
exit 0;
},
'-values' => \@unicode_block_list,
);
$popupbox->focus;
# Loop.
$cui->mainloop;
# Output after select 'Geometric Shapes' item:
# ┌────────────────────────────────────────────────────────┐
# │ Geometric Shapes │
# ├────────┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┤
# │ │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│ 9│ A│ B│ C│ D│ E│ F│
# ├────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
# │ U+25ax │ ■│ □│ ▢│ ▣│ ▤│ ▥│ ▦│ ▧│ ▨│ ▩│ ▪│ ▫│ ▬│ ▭│ ▮│ ▯│
# ├────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
# │ U+25bx │ ▰│ ▱│ ▲│ △│ ▴│ ▵│ ▶│ ▷│ ▸│ ▹│ ►│ ▻│ ▼│ ▽│ ▾│ ▿│
# ├────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
# │ U+25cx │ ◀│ ◁│ ◂│ ◃│ ◄│ ◅│ ◆│ ◇│ ◈│ ◉│ ◊│ ○│ ◌│ ◍│ ◎│ ●│
# ├────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
# │ U+25dx │ ◐│ ◑│ ◒│ ◓│ ◔│ ◕│ ◖│ ◗│ ◘│ ◙│ ◚│ ◛│ ◜│ ◝│ ◞│ ◟│
# ├────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
# │ U+25ex │ ◠│ ◡│ ◢│ ◣│ ◤│ ◥│ ◦│ ◧│ ◨│ ◩│ ◪│ ◫│ ◬│ ◭│ ◮│ ◯│
# ├────────┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
# │ U+25fx │ ◰│ ◱│ ◲│ ◳│ ◴│ ◵│ ◶│ ◷│ ◸│ ◹│ ◺│ ◻│ ◼│◽│◾│ ◿│
# └────────┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
DEPENDENCIES
Error::Pure, Readonly, Text::UnicodeBox, Text::UnicodeBox::Control, Unicode::Block.
REPOSITORY
https://github.com/michal-josef-spacek/Unicode-Block-Ascii
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2013-2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.04