Acme-Pills

 view release on metacpan or  search on metacpan

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

	$file =~ s[(for[^;]+{)(\s*)]
		      [$1$2last unless Acme::Incorporated::breaks();$2]xsg;

	return _fake_module_fh( $file );
}

sub out_of_stock
{
	my ($module, $modfile) = @_;

	return _fake_module_fh(<<END_MODULE);
print "$module is out of stock at the moment.\n"
delete \$INC{$modfile};
END_MODULE

}

sub _fake_module_fh
{
	my $text = shift;
	my $fh   = IO::File->new_tmpfile() or return;

	$fh->print( $text );
	$fh->seek( 0, 0 );

	return $fh;
}

sub bad_product
{
	my $weight = rand();

	return \&empty_box          if $weight <= 0.10;
	return \&breaks_when_needed if $weight <= 0.20;
	return \&out_of_stock       if $weight <= 0.30;

	return sub {};
}

sub breaks
{
	return rand() <= 0.10;
}

1;
__END__

=head1 NAME

Acme, Inc. produces fine and wonderful products for your pleasure. 

=head1 SYNOPSIS

  use Acme::Pills;

  # your normal code

=head1 DESCRIPTION

Acme, Inc. produces fine and wonderful products for your pleasure.  We have a
huge catalog of products for your enjoyment, including many CPAN modules.
Remember to go to Acme, Inc. first.

=head1 USAGE

Just use Acme::Pills before any other Perl module and we'll rush our
version right to you at the right price and at the right time.

B<WARNING>  Supplies are limited.  Please act fast.  Some modules may be
unavailable.

=head1 FUNCTIONS

You should never have to know how we at Acme, Pills do what we do, but
recently people have raised questions about the reliability of our products.
We strive for transparency in our work and have nothing to fear from your
scrutiny.  Our main magic comes from the function:

=over 4

=item C<fine_products>

Here we recognize your need for an external product and rush to fulfill your
order immediately.

=back

=head1 BUGS

As you'd expect.

Some of our competitors, being the jealous types, and some troublemakers,
having nothing better to do, claim that our fulfillment and quality assurance
departments are full of errors.  We disclaim this, specifically in five parts:

=over 4

=item C<bad_product>

Some people claim that we ship bad products, up to 30% of the time.  This is
not true.  All of our products work exactly as we have designed them to work.
Any error rests with the user, or more likely a competing product clever
disguised as ours.

=item C<breaks>

Another claim is that our work breaks up to 10% of the time.  This is a lie
that we shall not dignify any further.

=item C<breaks_when_needed>

The third claim is that our products somehow detect your hour of need and
suddenly fail to work immediately.  This is clearly a coincidence; our minds
love to see patterns even when they are not present.  Think of all of the times
ourproducts have worked perfectly and you will see that, even if our products
ever broke, you merely see coincidences.

=item C<empty_box>

One particularly disturbing claim is that we occasionally ship empty boxes.  If
this ever happens, please return the box for a full one.



( run in 0.962 second using v1.01-cache-2.11-cpan-5735350b133 )