Acme-Bleach
view release on metacpan or search on metacpan
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!)
lib/Acme/Bleach.pm view on Meta::CPAN
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<really> clean programs
=head1 SYNOPSIS
lib/Acme/DWIM.pm view on Meta::CPAN
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
lib/Acme/Morse.pm view on Meta::CPAN
package Acme::Morse; $VERSION = 1.0;
my $signed = ".--.-..--..---.-.--."x2;
sub encypher { local $_ = unpack "b*", pop; tr/01/.-/; s/(.{40})/$1\n/g;
$signed."\n".$_ }
sub decypher { local $_ = pop; s/^$signed|[^.-]//g; tr/.-/01/; pack "b*", $_ }
sub garbled { $_[0] =~ /\S/ }
sub signed { $_[0] =~ /^$signed/ }
open 0 or print "Can't transmit '$0'\n" and exit;
(my $telegram = join "", <0>) =~ 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
( run in 1.045 second using v1.01-cache-2.11-cpan-5a3173703d6 )