Acme-MJD

 view release on metacpan or  search on metacpan

lib/Acme/MJD.pm  view on Meta::CPAN

package Acme::MJD;
$VERSION = '0.02';

my $glass = " \t"x8;
sub reflect { local $_ = unpack "b*", pop; tr/01/ \t/; s/(.{9})/$1\n/g; $glass.$_ }
sub deflect { local $_ = pop; s/^$glass|[^ \t]//g; tr/ \t/01/; pack "b*", $_ }
sub opaque  { $_[0] =~ /\S/ }
sub deep    { $_[0] =~ /^$glass/ }

open 0 or print "Can't open '$0'\n" and exit;
(my $thought = join "", <0>) =~ s/.*^\s*use\s+Acme::MJD\s*;\n\n(?:.*?--\s+Mark\s+Jason\s+Dominus.*?\n)?//sm;

local $SIG{__WARN__} = \&opaque;
do {eval deflect $thought; exit} unless opaque $thought and not deep $thought;

my $DeepThought = '';
{
    my $rand = int rand 66;
    while($rand > 0){
        $DeepThought = <DATA>;
        $rand--;
    }
    close DATA;
    chomp $DeepThought;
    $DeepThought =~ s/^\#\d+\s//;

    require Text::Wrap;
    local $Text::Wrap::columns = 72;

    my @lines = Text::Wrap::wrap('', '', $DeepThought);

    if(length $lines[-1] < 63 ){
        $lines[-1] .= "  --  Mark Jason Dominus";
    } else {
        push @lines, "        --  Mark Jason Dominus";
    }

    $DeepThought = join "\n",@lines;
}

open 0, ">$0" or print "Cannot ponder '$0'\n" and exit;
print {0} "use Acme::MJD;\n\n$DeepThought\n", reflect $thought and exit;

=head1 NAME

Acme::MJD - Mark Jason Dominus does perl


=head1 SYNOPSIS

    use Acme::MJD;
    print "Hello world";

=head1 DESCRIPTION

The first time you run a program under C<use Acme::MJD>, 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 contains a profound nugget of wisdom from the man himself,
Mark Jason Dominus (E<lt>http://perl.plover.com/E<gt>).

These nuggets were mined from a comp.lang.perl.misc 
post by MJD entitled "Good Advice and Maxims for Programmers"
(E<lt>http://groups.google.com/groups?selm=a6ukat%24a4b%241%40plover.comE<gt>).

=head1 BUGS

Please don't report bugs ;)
But if you really really need to, go to 
E<lt>http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-MJDE<gt>
or send mail to E<lt>bug-Acme-MJD#rt.cpan.orgE<gt>


=head1 AUTHOR

	D. H. (PODMASTER)

=head1 COPYRIGHT

This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the
LICENSE file included with this module distribution.


=head1 SEE ALSO

L<Acme::Bushisms|Acme::Bushisms>, L<Acme::Bleach|Acme::Bleach>, L<Acme::DeepThoughts|Acme::DeepThoughts>.

=cut



( run in 1.096 second using v1.01-cache-2.11-cpan-140bd7fdf52 )