Acme-Phlegethoth

 view release on metacpan or  search on metacpan

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


sub summon {
	my $old_one = unpack "b*", shift;
	my $prayer  = $hear_me;
	my $chant   = "";

	foreach my $tentacle (split //, $old_one) {
		$chant = reverse(
			((rand() < 0.25) ? $pre[rand @pre] : "") .
			$word[rand @word] .
			((rand() < 0.25) ? $suf[rand @suf] : "") .
			((rand() < 0.1) ? "! " : "") .
			" "
		) unless length $chant;
		$prayer .= $1, redo if $chant =~ s/([^a-z])$//;
		$prayer .= chop $chant;
		substr($prayer, -1, 1) =~ tr[a-z][A-Z] if $tentacle;
	}

	$prayer .= $amen;
}

sub banish {
	local $_ = shift;
	s/^\Q$hear_me//; s/\Q$amen\E$//; tr[a-zA-Z][]cd; tr[a-z][0]; tr[A-Z][1];
	pack "b*", $_;
}

sub see { $_[0] =~ /\S/ }
sub comprehend { $_[0] =~ /^\Q$hear_me/ }
sub roll_sanity_check { &see }

sub import {
	no strict 'refs';
	open 0 or warn "Can't summon '$0'\n" and exit;
	(my $old1 = join "", <0>) =~ (
		s/(.*^\s*)use\s+Acme('|::)Phlegethoth\s*;\s*\n//sm
	);
	my $harbinger = $1 || "";
	local $SIG{__WARN__} = \&roll_sanity_check;
	do {eval banish $old1; exit} unless see $old1 and not comprehend $old1;
	open 0, ">$0" or warn "Can't banish '$0'\n" and exit;
	print {0} "${harbinger}use Acme'Phlegethoth;\n", summon $old1 and exit;
	print "${harbinger}use Acme'Phlegethoth;\n", summon $old1 and exit;
}

__END__

=head1 NAME

Acme::Phlegethoth - Improve your code's readability, if you're an Ancient One

=head1 SYNOPSIS

	use Acme::Phlegethoth;
	print "goodbye, world!\n";

=head1 DESCRIPTION

Acme::Phlegethoth improves the readability of your Perl programs to
the Elder Gods.  This may accelerate a debugging session where you
feel compelled to invoke them.  After all, if you're outsourcing
development to Cthulhu, you'd better damn well be sure He can read
your code.

Acme::Phlegethoth translates your code to Aklo the first time your
program uses it.  From that point on, your program continues to work
as before, but it now looks something like this:

	use Acme'Phlegethoth;
	ia ia!  mnahN' NAflHriI R'LuHnyTh BUgoR SLl'HAog gOf'NN Hai ron
	gOf'nn Nnn'aIog FHTagN LlLL YHlIRgHOG GoF'Nn naCh'!  nNNvuLgtlAGlN
	thROD!  PhLeGetH StelL'BsNaoth sll'Ha!  aH NAfL'AIyAR H'EbUMna
	HliRGHog eHYeOG nnnSgn'WAhL fm'laTgh ah ILYaA h'zHRO iLYaa
	H'gnaIihNYtH EBumnA s'Uhnor [Text ends abruptly.]

which loosely translates to:

	Hear me!

	Call upon the cowardly servants of the unbelievers!  Invite them to
	into our Church!  Watch over them, protect them!  These heretic
	children will enter the beyond to sleep beside our Master!

	Prepare us for the time when the Servants of your Father rise from
	the Pit to fulfil his pact.

	Our unshaken belief will protect our place on Earth!

	[Text ends abruptly.]

=head1 DIAGNOSTICS

=over 4

=item C<Can't summon '%s'>

Acme::Phlegethoth could not access your code to translate it into
Aklo.  The Ancient Ones will be most displeased.

=item C<Can't banish '%s'>

Acme::Phlegethoth could not access your prayer to execute it.  Never
let this happen.  The Sleeping Ones do not like to be awakened without
reason.

=head1 AUTHOR

Rocco Caputo <rcaputo@cpan.org>

This was loosely based on Leon Brocard's Acme::Buffy, which in turn
was based on Damian Conway's Bleach module.  That was inspired by an
idea by Philip Newton.  By now there's enough blame for everyone.

But what really sparked my imagination was Meng Weng Wong's quote from
a couple Ruby users:

	<flippo> ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!
	<ibroadfo> flippo: don't paste perl in here

They will of course be eaten last.



( run in 0.992 second using v1.01-cache-2.11-cpan-39bf76dae61 )