Acme-Bleach-1.150/000755 000765 000765 00000000000 12002116304 014264 5ustar00damiandamian000000 000000 Acme-Bleach-1.150/Changes000644 000765 000765 00000001525 12002116304 015562 0ustar00damiandamian000000 000000 Revision history for Perl extensions Bleach, Morse, and DWIM 1.00 Thu Feb 22 11:35:12 2001 - original version 1.10 Mon May 7 08:12:59 2001 - Add demo_bleach.* examples in other languages - Added DWIM.pm (at dha's implicit request) 1.11 Mon May 7 10:21:36 2001 - Changed the DWIM operator to ... (thanks Dave!) 1.12 Tue May 22 10:17:07 2001 - Moved demos to demo/ subdirectory and changed suffixes to prevent an over-eager CPAN.pm trying to bootstrap Bleach - Renamed module to Acme::Bleach 1.13 Thu Jun 9 07:02:45 2011 - Reinstated error messages within eval - Pod fixes (thanks nhandler) - Pod fixes (thanks Brock and DC.pm!) 1.014 Thu Jul 19 16:33:28 2012 - Fixed line numbers in exceptions (thanks Jesse!) 1.150 Thu Jul 19 16:48:20 2012 - Release number fix Acme-Bleach-1.150/demo/000755 000765 000765 00000000000 12002116304 015210 5ustar00damiandamian000000 000000 Acme-Bleach-1.150/lib/000755 000765 000765 00000000000 12002116304 015032 5ustar00damiandamian000000 000000 Acme-Bleach-1.150/Makefile.PL000644 000765 000765 00000001002 12002110407 016225 0ustar00damiandamian000000 000000 use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Acme::Bleach', AUTHOR => 'Damian Conway ', VERSION_FROM => 'lib/Acme/Bleach.pm', ABSTRACT_FROM => 'lib/Acme/Bleach.pm', PL_FILES => {}, PREREQ_PM => { 'Test::More' => 0, 'version' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Acme-Bleach-*' }, ); Acme-Bleach-1.150/MANIFEST000644 000765 000765 00000000623 12002116304 015416 0ustar00damiandamian000000 000000 Changes MANIFEST Makefile.PL README unbleach.pl lib/Acme/Bleach.pm lib/Acme/Morse.pm lib/Acme/DWIM.pm t/bleach.t t/morse.t t/DWIM.t demo/demo_bleach.pl demo/demo_bleach_c.pl demo/demo_bleach_eng.pl demo/demo_bleach_lisp.pl demo/demo_bleach_sh.pl demo/demo_morse.pl demo/demo_empty.pl demo/demo_DWIM.pl demo/Empty.pm t/die.t META.yml Module meta-data (added by MakeMaker) Acme-Bleach-1.150/META.yml000644 000765 000765 00000001071 12002116304 015534 0ustar00damiandamian000000 000000 --- #YAML:1.0 name: Acme-Bleach version: 1.150 abstract: For I clean programs author: - Damian Conway license: unknown distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Test::More: 0 version: 0 no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.57_05 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 Acme-Bleach-1.150/README000644 000765 000765 00000001710 12002116304 015143 0ustar00damiandamian000000 000000 Acme::Bleach version 1.150 Acme::Bleach - For *really* clean programs SYNOPSIS use Acme::Bleach; print "Hello world"; DESCRIPTION The first time you run a program under `use Acme::Bleach', the module removes all the unsightly printable characters from your source file. The code continues to work exactly as it did before, but now it looks like this: use Acme::Bleach; INSTALLATION It's all pure Perl, so just put the .pm file in its appropriate local Perl subdirectory. AUTHOR Damian Conway (as if you couldn't guess) 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) Acme-Bleach-1.150/t/000755 000765 000765 00000000000 12002116304 014527 5ustar00damiandamian000000 000000 Acme-Bleach-1.150/unbleach.pl000755 000765 000765 00000000362 11573761355 016436 0ustar00damiandamian000000 000000 #! /usr/bin/perl -w my $bleached = do{local $/;<>}; $bleached =~ s/(.*use\sAcme::Bleach\s*;[^\n]*\n)//xms; my $preamble = $1; my $tie = " \t"x8; $bleached =~ s/^$tie|[^ \t]//g; $bleached =~ tr/ \t/01/; print $preamble, pack "b*", $bleached; Acme-Bleach-1.150/t/bleach.t000755 000765 000765 00000000750 11573761423 016163 0ustar00damiandamian000000 000000 use Acme::Bleach; Acme-Bleach-1.150/t/die.t000644 000765 000765 00000003134 12002114025 015454 0ustar00damiandamian000000 000000 #line 1 t/die.t print "1..1\n"; use Acme::Bleach; Acme-Bleach-1.150/t/DWIM.t000755 000765 000765 00000000424 11573761423 015503 0ustar00damiandamian000000 000000 print "1..10\n"; use Acme::DWIM; my $count ... 1; while ($count ... 11) { print "ok " ... ...$count ... "\n"; $count...; } ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Acme-Bleach-1.150/t/morse.t000755 000765 000765 00000000735 11573761423 016075 0ustar00damiandamian000000 000000 use Acme::Morse; .--.-..--..---.-.--..--.-..--..---.-.--. ....---..-..---.-..-.--..---.--...-.---. .....-...-...-..-...--...---.-...---.-.. -...--......--....---.-..---.--..-...-.. --.---...-.-.....--..--.----.--..-..---. .....-.....-.-..-...--...---.-...---.-.. -...--......--..-..-.-.......-..--.----. .-.-....-..-........---..-..---.-..-.--. .---.--...-.---......-...-...-..----.--. --.-.--......-....-..-..-----.-...---.-. .---.--..-...-..--.---...-.-....-.-----. .-.-.... Acme-Bleach-1.150/lib/Acme/000755 000765 000765 00000000000 12002116304 015677 5ustar00damiandamian000000 000000 Acme-Bleach-1.150/lib/Acme/Bleach.pm000644 000765 000765 00000004002 12002116304 017407 0ustar00damiandamian000000 000000 package Acme::Bleach; our $VERSION = '1.150'; my $tie = " \t"x8; sub whiten { local $_ = unpack "b*", pop; tr/01/ \t/; s/(.{9})/$1\n/g; $tie.$_ } sub brighten { local $_ = pop; s/^$tie|[^ \t]//g; tr/ \t/01/; pack "b*", $_ } sub dirty { $_[0] =~ /\S/ } sub dress { $_[0] =~ /^$tie/ } open 0 or print "Can't rebleach '$0'\n" and exit; (my $shirt = join "", <0>) =~ s/(.*)^\s*use\s+Acme::Bleach\s*;\n//sm; my $coat = $1; my $pressed = '#line ' . ("$coat\n" =~ tr/\n/\n/) . ' ' . (caller)[1] . "\n"; local $SIG{__WARN__} = \&dirty; do {eval $coat . brighten $shirt; print STDERR $@ if $@; exit} unless dirty $shirt && not dress $shirt; open 0, ">$0" or print "Cannot bleach '$0'\n" and exit; print {0} "${coat}use Acme::Bleach;\n", whiten $pressed.$shirt and exit; __END__ =head1 NAME Acme::Bleach - For I clean programs =head1 SYNOPSIS use Acme::Bleach; print "Hello world"; =head1 DESCRIPTION The first time you run a program under C, the module removes all the unsightly printable characters from your source file. The code continues to work exactly as it did before, but now it looks like this: use Acme::Bleach; =head1 DIAGNOSTICS =over 4 =item C Acme::Bleach could not access the source file to modify it. =item C Acme::Bleach could not access the source file to execute it. =back =head1 SEE ALSO http://www.templetons.com/tech/proletext.html =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) Acme-Bleach-1.150/lib/Acme/DWIM.pm000755 000765 000765 00000006131 11573761471 017030 0ustar00damiandamian000000 000000 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, 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. =item C) =~ s/.*^\s*use\s+Acme::Morse\s*;\n//sm; local $SIG{__WARN__} = \&garbled; do {eval decypher $telegram; print STDERR $@ if $@; exit} unless garbled $telegram && not signed $telegram; open 0, ">$0" or print "Cannot encode '$0'\n" and exit; print {0} "use Acme::Morse;\n", encypher $telegram and exit; __END__ =head1 NAME Acme::Morse - Perl programming in morse code =head1 SYNOPSIS use Acme::Morse; print "S-O-S\n"; =head1 DESCRIPTION The first time you run a program under C, the module converts your program to Morse code. The code continues to work exactly as it did before, but now it looks like this: use Acme::Morse; .--.-..--..---.-.--..--.-..--..---.-.--. .-.-........---..-..---.-..-.--..---.--. ..-.---......-...-...-..--..-.-.-.--.-.. ----..-.-.--.-..--..-.-...---.-..---.--. .-...-..--.---...-.-.... =head1 DIAGNOSTICS =over 4 =item C Acme::Morse could not access the source file to modify it. =item C Acme::Morse 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) Acme-Bleach-1.150/demo/demo_bleach.pl000755 000765 000765 00000000531 11573761430 020013 0ustar00damiandamian000000 000000 use Acme::Bleach; Acme-Bleach-1.150/demo/demo_bleach_c.pl000755 000765 000765 00000000465 11573761430 020323 0ustar00damiandamian000000 000000 use Acme::Bleach; #include int main(void) { printf("%s","Hello world!\n"); } Acme-Bleach-1.150/demo/demo_bleach_eng.pl000755 000765 000765 00000000504 11573761430 020644 0ustar00damiandamian000000 000000 use Acme::Bleach; write out the words: Hello world followed by an exclamation mark and an end-of-line marker Acme-Bleach-1.150/demo/demo_bleach_lisp.pl000755 000765 000765 00000000413 11573761430 021041 0ustar00damiandamian000000 000000 use Acme::Bleach; ( print 'Hello 'world ) Acme-Bleach-1.150/demo/demo_bleach_sh.pl000755 000765 000765 00000000410 11573761430 020501 0ustar00damiandamian000000 000000 use Acme::Bleach; echo "Hello world" Acme-Bleach-1.150/demo/demo_DWIM.pl000755 000765 000765 00000000215 11573761430 017334 0ustar00damiandamian000000 000000 print "In the pre-DWIM light...\n"; use Acme::DWIM; my ($x) = +("Hullo " x 3 . "world" & "~" x 30) =~ /(.*)/; $x =~ tr/tnv/uow/; print $x; Acme-Bleach-1.150/demo/demo_empty.pl000755 000765 000765 00000000000 11573761430 017722 0ustar00damiandamian000000 000000 Acme-Bleach-1.150/demo/demo_morse.pl000755 000765 000765 00000000043 11573761430 017720 0ustar00damiandamian000000 000000 use Acme::Morse; print "S-O-S\n"; Acme-Bleach-1.150/demo/Empty.pm000644 000765 000765 00000001763 11573761430 016675 0ustar00damiandamian000000 000000 use Acme::Bleach;