line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Block::List; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
4
|
|
|
4
|
|
111724
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
240
|
|
5
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
123
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Modules. |
8
|
4
|
|
|
4
|
|
3684
|
use Class::Utils qw(set_params); |
|
4
|
|
|
|
|
58322
|
|
|
4
|
|
|
|
|
90
|
|
9
|
4
|
|
|
4
|
|
223096
|
use Unicode::Block; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Unicode::UCD qw(charblock charblocks); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Version. |
13
|
|
|
|
|
|
|
our $VERSION = 0.02; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Constructor. |
16
|
|
|
|
|
|
|
sub new { |
17
|
|
|
|
|
|
|
my ($class, @params) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Create object. |
20
|
|
|
|
|
|
|
my $self = bless {}, $class; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Process parameters. |
23
|
|
|
|
|
|
|
set_params($self, @params); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Object. |
26
|
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Get block. |
30
|
|
|
|
|
|
|
sub block { |
31
|
|
|
|
|
|
|
my ($self, $block) = @_; |
32
|
|
|
|
|
|
|
my $charblock_ar = charblock($block); |
33
|
|
|
|
|
|
|
if (ref $charblock_ar ne 'ARRAY' || ! @{$charblock_ar}) { |
34
|
|
|
|
|
|
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
my $char_from = sprintf '%04x', $charblock_ar->[0]->[0]; |
37
|
|
|
|
|
|
|
my $char_to = sprintf '%04x', $charblock_ar->[0]->[1]; |
38
|
|
|
|
|
|
|
return Unicode::Block->new( |
39
|
|
|
|
|
|
|
'title' => $charblock_ar->[0]->[2], |
40
|
|
|
|
|
|
|
'char_from' => $char_from, |
41
|
|
|
|
|
|
|
'char_to' => $char_to, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Get list of blocks. |
46
|
|
|
|
|
|
|
sub list { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
my $charblocks_hr = charblocks(); |
49
|
|
|
|
|
|
|
return sort keys %{$charblocks_hr}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |