line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
3
|
|
|
|
|
|
|
# Perl source filter to filter Unicode representations of some operators |
4
|
|
|
|
|
|
|
# Philip R Brenan at gmail dot com, Appa Apps Ltd, 2016 |
5
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package UnicodeOperators; |
8
|
|
|
|
|
|
|
require v5.16.0; |
9
|
1
|
|
|
1
|
|
84519
|
use warnings FATAL => qw(all); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
67
|
|
10
|
1
|
|
|
1
|
|
10
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
11
|
1
|
|
|
1
|
|
464
|
use Filter::Util::Call; |
|
1
|
|
|
|
|
1060
|
|
|
1
|
|
|
|
|
379
|
|
12
|
|
|
|
|
|
|
our $VERSION = '20170808'; # Started: Monday 19 September 2016 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import |
15
|
1
|
|
|
1
|
|
12
|
{my ($type) = @_; |
16
|
1
|
|
|
|
|
3
|
my ($ref) = []; |
17
|
1
|
|
|
|
|
7
|
filter_add(bless $ref); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub filter |
21
|
5
|
|
|
5
|
0
|
50
|
{my ($self) = @_; |
22
|
5
|
|
|
|
|
29
|
my $status = filter_read(); |
23
|
5
|
100
|
|
|
|
18
|
if ($status > 0) |
24
|
4
|
|
|
|
|
18
|
{s/\xE2\x88\x99/->/gs; |
25
|
4
|
|
|
|
|
12
|
s/\xE2\x96\xBA/=>/gs; |
26
|
4
|
|
|
|
|
12
|
s/\xE2\x97\x8B/=~/gs; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
$status |
29
|
5
|
|
|
|
|
1917
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding utf-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 Name |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
UnicodeOperators - Unicode versions of some Perl operators |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 Synopsis |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use UnicodeOperators; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
say STDERR sub {$_[0]}∙(2), {a►1, b►2, c►3}∙{a}, "aaa" ○ s/a/b/gsr; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# 21bbb |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 Description |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Replace -> with ∙, => with ► and =~ with ○ |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 Installation |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Standard Module::Build process for building and installing modules: |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
perl Build.PL |
57
|
|
|
|
|
|
|
./Build |
58
|
|
|
|
|
|
|
./Build test |
59
|
|
|
|
|
|
|
./Build install |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 Author |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
philiprbrenan@gmail.com |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
http://www.appaapps.com |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 Copyright |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Copyright (c) 2016 Philip R Brenan. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This module is free software. It may be used, redistributed and/or |
72
|
|
|
|
|
|
|
modified under the same terms as Perl itself. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub test |
77
|
0
|
|
|
0
|
0
|
|
{my $p = __PACKAGE__; |
78
|
0
|
0
|
|
|
|
|
return if eval "eof(${p}::DATA)"; |
79
|
0
|
|
|
|
|
|
my $s = eval "join('', <${p}::DATA>)"; |
80
|
0
|
0
|
|
|
|
|
$@ and die $@; |
81
|
0
|
|
|
|
|
|
eval $s; |
82
|
0
|
0
|
|
|
|
|
$@ and die $@; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
test unless caller; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |