| Acme-CorpusScrambler documentation | Contained in the Acme-CorpusScrambler distribution. |
Acme::CorpusScrambler - An Acme way doing Lorem Ipsum.
version 0.04
use Acme::CorpusScrambler;
my $foo = Acme::CorpusScrambler->new();
my $text = $foo->scramble;
Object constructor, no parameters required.
Feeds the $corpus to object, indexed by $keyword. The corpus is used latter as scrambling material.
Generate a piece of lipsum text accroding to @keyword. If you didn't feed any corpus before with feed() method, it will use Text::Greeking::zh_TW's default corpus.
Kang-min Liu <gugod at gugod.org>
shelling <navyblueshellingford at gmail.com>
Please report any bugs or feature requests to shelling at cpan.org or gugod at gugod.org
You can find documentation for this module with the perldoc command.
perldoc Acme::CorpusScrambler
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-CorpusScrambler
Copyright @ 2007-2008 Kang-min Liu, shelling, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Acme-CorpusScrambler documentation | Contained in the Acme-CorpusScrambler distribution. |
package Acme::CorpusScrambler; use warnings; use strict; use Text::Greeking::zh_TW;
our $VERSION = '0.04';
sub new { my $class = shift; bless {}, $class; }
my %corpushash; sub feed { my ($self, $keyword, $corpus) = @_; $corpushash{"$keyword"}="$corpus"; $self; }
sub scramble { my ($self, @keyword) = @_; my $g = Text::Greeking::zh_TW->new; $g->paragraphs(3,15); $g->sentences(2,10); if (@keyword) { my $newcorpus = join("\n\n", @corpushash{ grep { exists $corpushash{$_} } @keyword }); if ($newcorpus) { $g->add_source($newcorpus); return $g->generate; } return "" }else { return $g->generate; } }
1;