line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::emcA; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
613
|
use 5.004; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict qw[vars subs]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
4
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
690
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.10E0'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
open 0 or print "Can't reverse '$0'\n" and exit; |
10
|
|
|
|
|
|
|
( my $code = join "", <0> ) =~ s/.*?^(\s*);?use\s+Acme::emcA\s*(?: esu)?;\n//sm; |
11
|
|
|
|
|
|
|
my $max = 10 + length $1; |
12
|
|
|
|
|
|
|
local $SIG{__WARN__} = \&is_forward; |
13
|
|
|
|
|
|
|
do { eval forward($code); exit } if is_backward($code); |
14
|
|
|
|
|
|
|
open 0, ">$0" or print "Can't reverse '$0'\n" and exit; |
15
|
|
|
|
|
|
|
$max = 10; |
16
|
|
|
|
|
|
|
$code = backward($code); |
17
|
|
|
|
|
|
|
$code = |
18
|
|
|
|
|
|
|
( " " x ( $max - 10 ) ) |
19
|
|
|
|
|
|
|
. ";use Acme::emcA esu;\n" |
20
|
|
|
|
|
|
|
. ( " " x ( $max * 2 ) ) . "\n" |
21
|
|
|
|
|
|
|
. $code; |
22
|
|
|
|
|
|
|
print {0} $code . ( join( "\n", reverse split( /\n/, $code ) ) ), "\n" and exit; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub forward { |
25
|
1
|
|
|
1
|
0
|
131
|
join( "\n", |
26
|
|
|
|
|
|
|
map substr( $_, $max ), |
27
|
|
|
|
|
|
|
( split "\n", substr( $_[0], 0, length( $_[0] ) / 2 ) ) ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
0
|
0
|
sub is_forward { $_[0] !~ /^ {20,}$/m } |
31
|
1
|
50
|
|
1
|
0
|
73
|
sub is_backward { $_[0] =~ s/\n?.*$// if $_[0] =~ /^ {20,}$/m } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub backward { |
34
|
0
|
|
|
0
|
0
|
|
@_ = split "\n", $_[0]; |
35
|
0
|
|
0
|
|
|
|
length > $max && ( $max = length ) for @_; |
36
|
0
|
|
|
|
|
|
return join "\n", map sprintf( "%${max}s", scalar reverse $_ ) . $_, @_, ''; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |