Acme-Laugh
view release on metacpan or search on metacpan
lib/Acme/Laugh.pm view on Meta::CPAN
$pre = '' if (!$dopre) && (rand > 0.5);
my $post = (rand > 0.5) ? 'h' : '';
my $chunk = join '', $pre, $basso[rand @basso], $post;
return ($chunk, $post);
} ## end sub minichunk
sub continuum {
my $chunks = shift || 0;
$chunks = 1 + rand 4 if $chunks < 1;
my $p = 0;
return join '',
map { (my $c, $p) = minichunk(!$p); $c; } 1 .. $chunks;
} ## end sub continuum
sub capitals {
return join '', map { rand > 0.5 ? uc($_) : $_; } split //, shift;
}
sub laugh { return capitals(join '', incipit(), continuum(shift)); }
1; # Magic true value required at end of module
__END__
=head1 NAME
Acme::Laugh - add joy to your scripts.
=head1 VERSION
This document describes Acme::Laugh version 0.0.1
=head1 SYNOPSIS
use Acme::Laugh qw( laugh );
print laugh(5); # print a short laugh
print laugh(50); # print a long laugh
=head1 DESCRIPTION
=for l'autore, da riempire:
Fornite una descrizione completa del modulo e delle sue caratteristiche.
Aiutatevi a strutturare il testo con le sottosezioni (=head2, =head3)
se necessario.
Laughing is something that lets humans distinguish themselves from other
forms of life. Now computers are nearer to us :)
Have you ever needed to generate a laugh? I had: in IRC, to laugh at
other people (for fun!). So, here we are!
=head1 INTERFACE
This module lets you export the C<laugh> function:
=over
=item my $l = laugh( $length );
=item my $l = laugh(); # Random length
This function accepts an optional $length parameter, which lets you trim
the length of the generated laugh. This length has little to do with the
actual string length (which you can trim later, if you want), but higher
values generate longer laughs in average. Ok, peruse the code to see it!
=back
=head1 DEPENDENCIES
=for l'autore, da riempire:
Una lista di tutti gli altri moduli su cui si basa questo modulo,
incluse eventuali restrizioni sulle relative versioni, ed una
indicazione se il modulo in questione è parte della distribuzione
standard di Perl, parte della distribuzione del modulo o se
deve essere installato separatamente.
None.
=head1 INCOMPATIBILITIES
Acme::Pain, if it will ever be released. And similars, too.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through http://rt.cpan.org/
=head1 AUTHOR
Flavio Poletti C<< <flavio [at] polettix [dot] it> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2005, Flavio Poletti C<< <flavio [at] polettix [dot] it> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>
and L<perlgpl>.
Questo modulo è software libero: potete ridistribuirlo e/o
modificarlo negli stessi termini di Perl stesso. Vedete anche
L<perlartistic> e L<perlgpl>.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
( run in 0.578 second using v1.01-cache-2.11-cpan-ceb78f64989 )