Generate Random Text with Perl using Text::Lorem
Sepecially for testing purposes this is an easy way to generate random text. You can say how many words you would like to have and the words method of Text::Lorem will return a string with that many words.
examples/text_lorem.pl
use strict; use warnings; use Text::Lorem; sub create_payload { my $tl = Text::Lorem->new(); return { fname => $tl->words(1), lname => $tl->words(1), address => $tl->words(7), } } use Data::Dumper qw(Dumper); print Dumper create_payload(); =head1 Output $VAR1 = { 'fname' => 'quaerat', 'address' => 'est enim libero aut sit architecto quis', 'lname' => 'aliquam' }; =cut
Published on 2017-05-02
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post