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