line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Block; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
5
|
|
|
5
|
|
124902
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
222
|
|
5
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
158
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Modules. |
8
|
5
|
|
|
5
|
|
5035
|
use Class::Utils qw(set_params_pub); |
|
5
|
|
|
|
|
77719
|
|
|
5
|
|
|
|
|
96
|
|
9
|
5
|
|
|
5
|
|
3217
|
use Unicode::Block::Item; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
1529
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Version. |
12
|
|
|
|
|
|
|
our $VERSION = 0.03; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Constructor. |
15
|
|
|
|
|
|
|
sub new { |
16
|
4
|
|
|
4
|
1
|
4465
|
my ($class, @params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Create object. |
19
|
4
|
|
|
|
|
12
|
my $self = bless {}, $class; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Character from. |
22
|
4
|
|
|
|
|
28
|
$self->{'char_from'} = '0000', |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Character to. |
25
|
|
|
|
|
|
|
$self->{'char_to'} = '007F', |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Title. |
28
|
|
|
|
|
|
|
$self->{'title'} = undef; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Process parameters. |
31
|
4
|
|
|
|
|
23
|
set_params_pub($self, @params); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Count. |
34
|
2
|
|
|
|
|
26
|
$self->{'_count'} = $self->{'char_from'}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Object. |
37
|
2
|
|
|
|
|
7
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Get next character. |
41
|
|
|
|
|
|
|
sub next { |
42
|
2
|
|
|
2
|
1
|
7
|
my $self = shift; |
43
|
2
|
|
|
|
|
7
|
my $char_hex = $self->_count; |
44
|
2
|
100
|
|
|
|
27
|
if (defined $char_hex) { |
45
|
1
|
|
|
|
|
11
|
return Unicode::Block::Item->new('hex' => $char_hex); |
46
|
|
|
|
|
|
|
} else { |
47
|
1
|
|
|
|
|
3
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Get actual character and increase number. |
52
|
|
|
|
|
|
|
sub _count { |
53
|
2
|
|
|
2
|
|
2
|
my $self = shift; |
54
|
2
|
|
|
|
|
4
|
my $ret = $self->{'_count'}; |
55
|
2
|
100
|
|
|
|
6
|
if (! defined $ret) { |
56
|
1
|
|
|
|
|
2
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
1
|
|
|
|
|
4
|
my $num = hex $self->{'_count'}; |
59
|
1
|
|
|
|
|
1
|
$num++; |
60
|
1
|
|
|
|
|
2
|
my $last_num = hex $self->{'char_to'}; |
61
|
1
|
50
|
|
|
|
3
|
if ($num > $last_num) { |
62
|
1
|
|
|
|
|
2
|
$self->{'_count'} = undef; |
63
|
|
|
|
|
|
|
} else { |
64
|
0
|
|
|
|
|
0
|
$self->{'_count'} = sprintf '%x', $num; |
65
|
|
|
|
|
|
|
} |
66
|
1
|
|
|
|
|
3
|
return $ret; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |