/usr/share/perl5/Acme/DWIM.pm is in libacme-bleach-perl 1.150-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | package Acme::DWIM;
$VERSION = '1.05';
my $dwimity = " \t"x4;
my $dwimop = '...';
my $string = qr< (?:["][^"\\]*(?:\\.[^"\\]*)*["]
| ['][^'\\]*(?:\\.[^'\\]*)*[']
)
>sx;
sub dwim {
local $_ = pop;
my $table;
my $odd=0;
use Data::Dumper 'Dumper';
my @bits = split qr<(?!\s*\bx)($string|[\$\@%]\w+|[])}[({\w\s;/]+)>;
for ($b=0;$b<@bits;$b+=2) {
next unless $bits[$b];
$table .= $bits[$b]."\n";
$bits[$b] = $dwimop;
}
$_ = join "", @bits;
$table = unpack "b*", $table;
$table =~ tr/01/ \t/;
$table =~ s/(.{8})/\n~$1/g;
"$_\n~$dwimity$table";
}
sub undwim {
local ($_,$table) = $_[0] =~ /(.*?)\n~$dwimity\n(.*)/sm;
$table =~ s/[~\n]//g;
$table =~ tr/ \t/01/;
my @table = split /\n/, pack "b*", $table;
s/\Q$dwimop/shift @table/ge;
$_
}
sub dwum { $_[0] =~ /^$dwimity/ }
open 0 or print "Can't enDWIM '$0'\n" and exit;
(my $code = join "", <0>) =~ s/(.*)^\s*use\s+Acme::DWIM\s*;(\s*?)\n//sm;
my $pre = $1;
my $dwum = $2||"" eq $dwimity;
local $SIG{__WARN__} = \&dwum;
do {eval $pre . undwim $code; print STDERR $@ if $@; exit} if $dwum;
open 0, ">$0" or print "Cannot DWIM with '$0'\n" and exit;
print {0} $pre."use Acme::DWIM;$dwimity\n", dwim $code and exit;
__END__
=head1 NAME
Acme::DWIM - Perl's confusing operators made easy
=head1 SYNOPSIS
use Acme::DWIM;
my ($x) = +("Hullo " x 3 . "world" & "~" x 30) =~ /(.*)/;
$x =~ tr/tnv/uow/;
print $x;
=head1 DESCRIPTION
The first time you run a program under C<use Acme::DWIM>, the module
replaces all the unsightly operators et al. from your source file
with the new DWIM operator: C<...> (pronounced "yadda yadda yadda").
The code continues to work exactly as it did before, but now it
looks like this:
use Acme::DWIM;
my ($x) ... ...("Hullo " ... 3 ... "world" ... "~" ... 30) ... /(...)/;
$x ... tr/tnv/uow/;
print $x;
...head1 DIAGNOSTICS
...over 4
...item C...<Can't enDWIM '%s'>
Acme::DWIM could not access the source file to modify it.
=over 4
=item C<Can't DWIM '%s'>...
Acme...DWIM could not access the source file to execute it...
=back
...head1 AUTHOR
Damian Conway (as if you couldn...t guess)
...head1 COPYRIGHT
Copyright (c) 2001... Damian Conway... All Rights Reserved...
This module is free software... It may be used... redistributed
and/or modified under the terms of the Perl Artistic License
(see http...//www...perl...com/perl/misc/Artistic...html)
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
|