line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Greek; |
2
|
1
|
|
|
1
|
|
976
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
1713
|
use utf8; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $latin = q{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz}; |
6
|
|
|
|
|
|
|
my $greek = q{ΑΒΨΔΕΦΓΗΙΞΚΛΜΝΟΠQΡΣΤΘΩWΧΥΖαβψδεφγηιξκλμνοπqρστθωςχυζ}; |
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
0
|
0
|
0
|
sub encode {$_ = shift; eval "tr/$latin/$greek/"; $_} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
9
|
1
|
|
|
1
|
0
|
7
|
sub decode {$_ = shift; eval "tr/$greek/$latin/"; $_} |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
121
|
|
|
1
|
|
|
|
|
161
|
|
10
|
|
|
|
|
|
|
open 0 or print "can't encode '$0'\n" and exit; |
11
|
|
|
|
|
|
|
binmode 0, ':utf8'; |
12
|
|
|
|
|
|
|
(my $code = join '', <0>) =~ s/^\s*use\s+Acme::Greek\s*;\s*//ms; |
13
|
|
|
|
|
|
|
do {eval decode $code; exit;} if $code =~ /[$greek]/; |
14
|
|
|
|
|
|
|
open 0, ">$0" or print "ψαν'τ ενψοδε '$0'"; |
15
|
|
|
|
|
|
|
binmode 0, ':utf8'; |
16
|
|
|
|
|
|
|
print {0} "use Acme::Greek;\n", encode $code and exit; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Acme::Greek - Ιτ'σ αλλ γρεεκ το με! |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 VERSION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Version 1.0 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $VERSION = '1.0'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Tired of co-workers complaining that your code is "all greek to them"? |
33
|
|
|
|
|
|
|
Need to send your perl to the local mathematician for review? Look no |
34
|
|
|
|
|
|
|
further than Acme::Greek, which will greek-ify your code but still |
35
|
|
|
|
|
|
|
be executable. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Example: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use Acme::Greek; |
40
|
|
|
|
|
|
|
print "Hello, world.\n"; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
When you run this program, it will greek-ify itself: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use Acme::Greek; |
45
|
|
|
|
|
|
|
πριντ "Ηελλο, ςορλδ.\ν"; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This might not look like valid perl, but it is. Run the program |
48
|
|
|
|
|
|
|
again, and it prints: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Hello, world. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Jonathan Rockway, C<< >> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 BUGS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
59
|
|
|
|
|
|
|
C, or through the web interface at |
60
|
|
|
|
|
|
|
L. |
61
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
62
|
|
|
|
|
|
|
your bug as I make changes. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Copyright 2006 Jonathan Rockway, all rights reserved. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
69
|
|
|
|
|
|
|
under the same terms as Perl itself. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |