Acme-DeepThoughts
view release on metacpan or search on metacpan
lib/Acme/DeepThoughts.pm view on Meta::CPAN
package Acme::DeepThoughts;
$VERSION = '0.01';
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::DeepThoughts\s*;\n\n(?:.*?--\s+Jack\s+Handey.*?\n)?//sm;
local $SIG{__WARN__} = \&opaque;
do {eval deflect $thought; exit} unless opaque $thought and not deep $thought;
my $DeepThought = '';
{
my $rand = int rand 152;
while($rand > 0){
$DeepThought = <DATA>;
$rand--;
}
close DATA;
chomp $DeepThought;
require Text::Wrap;
local $Text::Wrap::columns = 72;
my @lines = Text::Wrap::wrap('', '', $DeepThought);
if(length $lines[-1] < 63 ){
$lines[-1] .= " -- Jack Handey";
} else {
push @lines, " -- Jack Handey";
}
$DeepThought = join "\n",@lines;
}
open 0, ">$0" or print "Cannot ponder '$0'\n" and exit;
print {0} "use Acme::DeepThoughts;\n\n$DeepThought\n", reflect $thought and exit;
=head1 NAME
Acme::DeepThoughts - Jack Handey does perl
=head1 SYNOPSIS
use Acme::DeepThoughts
print "Hello world";
=head1 DESCRIPTION
The first time you run a program under C<use Acme::DeepThoughts>, 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 I<Deep Thought>.
These deep thoughts were collected from E<lt>L<http://deepthoughts.330.ca/>E<gt>,
which is a site "I<dedicated to the quotes that used to appear on the hit TV show, Saturday Night Live (SNL)>."
=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-DeepThoughtsE<gt>
or send mail to E<lt>bug-Acme-DeepThoughts#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.
=head1 SEE ALSO
L<Acme::Bushisms|Acme::Bushisms>, L<Acme::Bleach|Acme::Bleach>,.
=cut
__DATA__
If I could be a bird, I'd be a Flying Purple People Eater because then people would sing about me and I could fly down and eat them because I hate that song.
( run in 0.955 second using v1.01-cache-2.11-cpan-140bd7fdf52 )