| 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 | use Filter::Util::Call; | ||
| 9 | |||
| 10 | sub import | ||
| 11 | {my ($type) = @_; | ||
| 12 | my ($ref) = []; | ||
| 13 | filter_add(bless $ref); | ||
| 14 | } | ||
| 15 | |||
| 16 | sub filter | ||
| 17 | {my ($self) = @_; | ||
| 18 | my $status = filter_read(); | ||
| 19 | if ($status > 0) | ||
| 20 | {s/\xE2\x88\x99/->/gs; | ||
| 21 | s/\xE2\x96\xBA/=>/gs; | ||
| 22 | s/\xE2\x97\x8B/=~/gs; | ||
| 23 | } | ||
| 24 | $status | ||
| 25 | } | ||
| 26 | |||
| 27 | $VERSION = '1.002'; # Monday 19 September 2016 | ||
| 28 | |||
| 29 | 1; | ||
| 30 | |||
| 31 | =encoding utf-8 | ||
| 32 | |||
| 33 | =head1 Name | ||
| 34 | |||
| 35 | UnicodeOperators - Unicode versions of some Perl operators | ||
| 36 | |||
| 37 | =head1 Synopsis | ||
| 38 | |||
| 39 | use UnicodeOperators; | ||
| 40 | |||
| 41 | say STDERR sub {$_[0]}∙(2), {a►1, b►2, c►3}∙{a}, "aaa" ○ s/a/b/gsr; | ||
| 42 | |||
| 43 | # 21bbb | ||
| 44 | |||
| 45 | =head1 Description | ||
| 46 | |||
| 47 | Replace -> with ∙, => with ► and =~ with ○ | ||
| 48 | |||
| 49 | =head1 Installation | ||
| 50 | |||
| 51 | Standard Module::Build process for building and installing modules: | ||
| 52 | |||
| 53 | perl Build.PL | ||
| 54 | ./Build | ||
| 55 | ./Build test | ||
| 56 | ./Build install | ||
| 57 | |||
| 58 | =head1 Author | ||
| 59 | |||
| 60 | philiprbrenan@gmail.com | ||
| 61 | |||
| 62 | http://www.appaapps.com | ||
| 63 | |||
| 64 | =head1 Copyright | ||
| 65 | |||
| 66 | Copyright (c) 2016 Philip R Brenan. | ||
| 67 | |||
| 68 | This module is free software. It may be used, redistributed and/or | ||
| 69 | modified under the same terms as Perl itself. | ||
| 70 | |||
| 71 | =cut |