NAME

Unicode::Block::Item - Class for unicode block character.

SYNOPSIS

use Unicode::Block::Item;

my $obj = Unicode::Block::Item->new(%parameters);
my $base = $obj->base;
my $char = $obj->char;
my $hex = $obj->hex;
my $last_hex = $obj->last_hex;
my $width = $obj->width;

METHODS

new

my $obj = Unicode::Block::Item->new(%parameters);

Constructor.

  • hex

    Hexadecimal number.

    It is required.

    Default value is undef.

  • hex_length

    Length of hex number. It's used for formatting of hex() method output.

    Default value is 4.

Returns instance of object.

base

my $base = $obj->base;

Get hex base number in format 'U+???x'. Example: 'hex' => 1234h; Returns 'U+123x'.

Returns string with hex base number.

char

my $char = $obj->char;

Get character. Example: 'hex' => 1234h; Returns 'ሴ'.

Returns string with character.

hex

my $hex = $obj->hex;

Get hex number in 'hex_length' length. Example: 'hex' => 1234h; Returns '0x1234'.

Returns string with hex number.

last_hex

my $last_hex = $obj->last_hex;

Get last hex number. Example: 'hex' => 1234h; Returns '4'.

Returns string with last hex number.

width

my $width = $obj->width;

Get character width.

Returns string with width.

ERRORS

new():
        Parameter 'hex' is required.
        Parameter 'hex' isn't hexadecimal number.
        From Class::Utils::set_params():
                Unknown parameter '%s'.

EXAMPLE

use strict;
use warnings;

use Unicode::Block::Item;
use Unicode::UTF8 qw(encode_utf8);

# Object.
my $obj = Unicode::Block::Item->new(
       'hex' => 2505,
);

# Print out.
print 'Character: '.encode_utf8($obj->char)."\n";
print 'Hex: '.$obj->hex."\n";
print 'Last hex character: '.$obj->last_hex."\n";
print 'Base: '.$obj->base."\n";

# Output.
# Character: ┅
# Hex: 2505
# Last hex character: 5
# Base: U+250x

DEPENDENCIES

Class::Utils, Error::Pure, Readonly, Text::CharWidth, Unicode::Char.

SEE ALSO

Unicode::Block

Class for unicode block manipulation.

REPOSITORY

https://github.com/tupinek/Unicode-Block

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2013-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.08