Acme::Bleach - For I<really> clean programs


Acme-Bleach documentation Contained in the Acme-Bleach distribution.

Index


Code Index:

NAME

Top

Acme::Bleach - For really clean programs

SYNOPSIS

Top

	use Acme::Bleach;

	print "Hello world";

DESCRIPTION

Top

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;

	   			  	


	  			 	  


		 		  			


	 		   	 	


			      	


	   	   	 


	    	  	 


		 	  		  


	 		 		   


			 		 			


		 		     


	 	  			 	


			 				 	


		  	  			


	   		 		 


	  	  		  


		   	  		


	 			   	 


		    





DIAGNOSTICS

Top

Can't bleach '%s'

Acme::Bleach could not access the source file to modify it.

Can't rebleach '%s'

Acme::Bleach could not access the source file to execute it.

SEE ALSO

Top

http://www.templetons.com/tech/proletext.html

AUTHOR

Top

Damian Conway (as if you couldn't guess)

COPYRIGHT

Top


Acme-Bleach documentation Contained in the Acme-Bleach distribution.

package Acme::Bleach;
our $VERSION = '1.13';
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;
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 $shirt and exit;
__END__