line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Fraction; |
2
|
1
|
|
|
1
|
|
886
|
use base qw(HTML::Fraction); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
862
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1036
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
14
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
130
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.30"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Our superclass sometimes uses named |
10
|
|
|
|
|
|
|
my %name2char = ( |
11
|
|
|
|
|
|
|
'1/4' => "\x{00BC}", |
12
|
|
|
|
|
|
|
'1/2' => "\x{00BD}", |
13
|
|
|
|
|
|
|
'3/4' => "\x{00BE}", |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _name2char { |
17
|
29
|
|
|
29
|
|
5173
|
my $self = shift; |
18
|
29
|
|
|
|
|
33
|
my $str = shift; |
19
|
|
|
|
|
|
|
|
20
|
29
|
|
|
|
|
68
|
my $entity = $self->SUPER::_name2char($str); |
21
|
29
|
100
|
|
|
|
139
|
if ($entity =~ /\A &\#(\d+); \z/x) { |
22
|
19
|
|
|
|
|
142
|
return chr($1); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
10
|
|
|
|
|
38
|
return $name2char{ $str } |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
String::Fraction - convert fractions into unicode chars |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use String::Fraction; |
35
|
|
|
|
|
|
|
print String::Fraction->tweak( <
|
36
|
|
|
|
|
|
|
When this is run through tweak things like 1/4 and 0.25 and 6.33 |
37
|
|
|
|
|
|
|
will be converted to unicode chars that represent the fractional parts |
38
|
|
|
|
|
|
|
ENDOFTEXT |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This module functions identically to its superclass B, |
43
|
|
|
|
|
|
|
but rather than converting fractions into HTML entities they are replaced |
44
|
|
|
|
|
|
|
by the unicode characters for those fractions. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Copyright Mark Fowler and Fotango 2005. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Copyright Mark Fowler 2012. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it |
53
|
|
|
|
|
|
|
under the same terms as Perl itself. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 BUGS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
None Known |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SEE ALSO |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |