1: package Acme::Bleach; 2: $VERSION = '1.12'; 3: my $tie = " \t"x8; 4:sub whiten { local $_ = unpack "b*", pop; tr/01/ \t/; s/(.{9})/$1\n/g; $tie.$_ } 5: sub brighten { local $_ = pop; s/^$tie|[^ \t]//g; tr/ \t/01/; pack "b*", $_ } 6: sub dirty { $_[0] =~ /\S/ } 7: sub dress { $_[0] =~ /^$tie/ } 8: open 0 or print "Can't rebleach '$0'\n" and exit; 9: (my $shirt = join "", <0>) =~ s/.*^\s*use\s+Acme::Bleach\s*;\n//sm; 10: local $SIG{__WARN__} = \&dirty; 11: do {eval brighten $shirt; exit} unless dirty $shirt && not dress $shirt; 12: open 0, ">$0" or print "Cannot bleach '$0'\n" and exit; 13: print {0} "use Acme::Bleach;\n", whiten $shirt and exit;