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(%parameters)

Constructor.

  • hex

    Hexadecimal number.
    Default value is undef.
    It is required.
  • hex_length

    Length of hex number.
    Default value is 4.
base()
Get hex base number in format 'U+???x'.
Example: 'hex' => 1234h; Returns 'U+123x'.
Returns string with hex base number.
char()
Get character.
Example: 'hex' => 1234h; Returns 'ሴ'.
Returns string with character.
hex()
Get hex number in 'hex_length' length.
Example: 'hex' => 1234h; Returns '0x1234'.
Returns string with hex number.
last_hex()
Get last hex number.
Example: 'hex' => 1234h; Returns '4'.
Returns string with last hex number.
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

# Pragmas.
use strict;
use warnings;

# Modules.
use Encode qw(encode_utf8);
use Unicode::Block::Item;

# 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.

REPOSITORY

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

AUTHOR

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

http://skim.cz

LICENSE AND COPYRIGHT

BSD license.

VERSION

0.01